1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use faker_rand::lorem::Paragraphs;
use crate::{
app::App,
clock::RequestedAt,
conversation::Conversation,
message::{self, Body, Message},
user::User,
};
pub async fn send(
app: &App,
conversation: &Conversation,
sender: &User,
sent_at: &RequestedAt,
) -> Message {
let body = propose();
app.messages()
.send(&conversation.id, sender, sent_at, &body)
.await
.expect("should succeed if the conversation exists")
}
pub fn propose() -> Body {
rand::random::<Paragraphs>().to_string().into()
}
pub fn fictitious() -> message::Id {
message::Id::generate()
}
|