feat: implement idempotency tokens

closes #108 and closes #106
This commit is contained in:
Paul
2021-11-01 18:32:45 +00:00
parent 49c7bc0ffe
commit 8d25dd1d65
12 changed files with 146 additions and 109 deletions

View File

@@ -181,6 +181,20 @@ impl Message {
}
pub async fn publish(self, channel: &Channel, process_embeds: bool) -> Result<()> {
// construct message and publish
// commit message to database
// spawn task_queue ( update last_message_id )
// spawn task_queue ( process embeds )
// if mentions {
// spawn task_queue ( update channel_unreads )
// }
// if (channel => DM | Group) | mentions {
// spawn task_queue ( web push )
// }
get_collection("messages")
.insert_one(to_bson(&self).unwrap().as_document().unwrap().clone(), None)
.await