mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 13:36:59 +00:00
Add message edit records + work on guilds.
This commit is contained in:
@@ -11,5 +11,11 @@ pub struct Channel {
|
||||
|
||||
// for Direct Messages
|
||||
pub recipients: Option<Vec<String>>,
|
||||
pub active: Option<bool>,
|
||||
pub active: Option<bool>,
|
||||
|
||||
// for Guilds
|
||||
pub name: Option<String>,
|
||||
|
||||
// for Guilds and Group DMs
|
||||
pub description: Option<String>,
|
||||
}
|
||||
|
||||
27
src/database/guild.rs
Normal file
27
src/database/guild.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use serde::{ Deserialize, Serialize };
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct Member {
|
||||
pub id: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct Invite {
|
||||
pub id: String,
|
||||
pub custom: bool,
|
||||
pub channel: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct Guild {
|
||||
#[serde(rename = "_id")]
|
||||
pub id: String,
|
||||
// pub nonce: String, used internally
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub owner: String,
|
||||
|
||||
pub channels: Vec<String>,
|
||||
pub members: Vec<Member>,
|
||||
pub invites: Vec<Invite>,
|
||||
}
|
||||
@@ -1,13 +1,22 @@
|
||||
use serde::{ Deserialize, Serialize };
|
||||
use bson::{ UtcDateTime };
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct PreviousEntry {
|
||||
pub content: String,
|
||||
pub time: UtcDateTime,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct Message {
|
||||
#[serde(rename = "_id")]
|
||||
pub id: String,
|
||||
// pub nonce: String, used internally
|
||||
pub channel: String,
|
||||
pub author: String,
|
||||
|
||||
pub content: String,
|
||||
pub edited: Option<UtcDateTime>,
|
||||
pub edited: Option<UtcDateTime>,
|
||||
|
||||
pub previous_content: Option<Vec<PreviousEntry>>
|
||||
}
|
||||
|
||||
@@ -27,3 +27,4 @@ pub fn get_collection(collection: &str) -> Collection {
|
||||
pub mod user;
|
||||
pub mod channel;
|
||||
pub mod message;
|
||||
pub mod guild;
|
||||
|
||||
Reference in New Issue
Block a user