forked from jmug/stoatchat
66 lines
1.8 KiB
Rust
66 lines
1.8 KiB
Rust
use crate::models::message::{AppendMessage, Message, MessageQuery, PartialMessage};
|
|
use crate::{AbstractMessage, Result};
|
|
|
|
use super::super::DummyDb;
|
|
|
|
#[async_trait]
|
|
impl AbstractMessage for DummyDb {
|
|
async fn fetch_message(&self, id: &str) -> Result<Message> {
|
|
Ok(Message {
|
|
id: id.into(),
|
|
channel: "channel".into(),
|
|
author: "author".into(),
|
|
content: Some("message content".into()),
|
|
|
|
..Default::default()
|
|
})
|
|
}
|
|
|
|
async fn insert_message(&self, message: &Message) -> Result<()> {
|
|
info!("Insert {message:?}");
|
|
Ok(())
|
|
}
|
|
|
|
async fn update_message(&self, id: &str, message: &PartialMessage) -> Result<()> {
|
|
info!("Update {id} with {message:?}");
|
|
Ok(())
|
|
}
|
|
|
|
async fn append_message(&self, id: &str, append: &AppendMessage) -> Result<()> {
|
|
info!("Append {id} with {append:?}");
|
|
Ok(())
|
|
}
|
|
|
|
async fn delete_message(&self, id: &str) -> Result<()> {
|
|
info!("Delete {id}");
|
|
Ok(())
|
|
}
|
|
|
|
async fn delete_messages(&self, channel: &str, ids: Vec<String>) -> Result<()> {
|
|
info!("Delete {ids:?} in {channel}");
|
|
Ok(())
|
|
}
|
|
|
|
async fn fetch_messages(&self, _query: MessageQuery) -> Result<Vec<Message>> {
|
|
Ok(vec![])
|
|
}
|
|
|
|
/// Add a new reaction to a message
|
|
async fn add_reaction(&self, id: &str, emoji: &str, user: &str) -> Result<()> {
|
|
info!("Add to {id} with {emoji} and {user}");
|
|
Ok(())
|
|
}
|
|
|
|
/// Remove a reaction from a message
|
|
async fn remove_reaction(&self, id: &str, emoji: &str, user: &str) -> Result<()> {
|
|
info!("Remove {emoji} from {id} for {user}");
|
|
Ok(())
|
|
}
|
|
|
|
/// Remove reaction from a message
|
|
async fn clear_reaction(&self, id: &str, emoji: &str) -> Result<()> {
|
|
info!("Clear {emoji} on {id}");
|
|
Ok(())
|
|
}
|
|
}
|