use axum::extract::FromRef; use faker_rand::lorem::Paragraphs; use crate::{ clock::RequestedAt, conversation::Conversation, login::Login, message::{self, Body, Message, app::Messages}, }; pub async fn send( app: &App, conversation: &Conversation, sender: &Login, sent_at: &RequestedAt, ) -> Message where Messages: FromRef, { let body = propose(); Messages::from_ref(app) .send(&conversation.id, sender, sent_at, &body) .await .expect("should succeed if the conversation exists") } pub fn propose() -> Body { rand::random::().to_string().into() } pub fn fictitious() -> message::Id { message::Id::generate() }