Add member_count to /invites/:id

This commit is contained in:
jan0660
2021-07-25 16:49:27 +02:00
parent 682b6cbd9f
commit ca04f4d510
2 changed files with 17 additions and 0 deletions

View File

@@ -425,4 +425,19 @@ impl Server {
Ok(())
}
pub async fn get_member_count(id: &str) -> Result<i64> {
Ok(get_collection("server_members")
.count_documents(
doc! {
"_id.server": id
},
None,
)
.await
.map_err(|_| Error::DatabaseError {
operation: "count_documents",
with: "server_members",
})?)
}
}