daemon: maintain outgoing message reference so model is consistent
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use chrono::{DateTime, NaiveDateTime};
|
||||
use uuid::Uuid;
|
||||
use crate::models::participant::Participant;
|
||||
use kordophone::model::outgoing_message::OutgoingMessage;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Message {
|
||||
@@ -40,6 +41,17 @@ impl From<kordophone::model::Message> for Message {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&OutgoingMessage> for Message {
|
||||
fn from(value: &OutgoingMessage) -> Self {
|
||||
Self {
|
||||
id: value.guid.to_string(),
|
||||
sender: Participant::Me,
|
||||
text: value.text.clone(),
|
||||
date: value.date,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MessageBuilder {
|
||||
id: Option<String>,
|
||||
sender: Option<Participant>,
|
||||
|
||||
Reference in New Issue
Block a user