Servers: Create and delete invites. Create and fetch servers.

This commit is contained in:
Paul
2021-06-05 22:41:47 +01:00
parent 681b2b8ab6
commit f9fbe54b17
16 changed files with 281 additions and 57 deletions

View File

@@ -13,6 +13,7 @@ pub enum Invite {
Server {
#[serde(rename = "_id")]
code: String,
server: String,
creator: String,
channel: String,
},
@@ -35,6 +36,13 @@ impl Invite {
}
}
pub fn creator(&self) -> &String {
match &self {
Invite::Server { creator, .. } => creator,
Invite::Group { creator, .. } => creator,
}
}
pub async fn get(code: &str) -> Result<Invite> {
let doc = get_collection("invites")
.find_one(doc! { "_id": code }, None)