1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-07-10 01:22:48 +00:00

Can remove a key from the list of keys of an admin

This commit is contained in:
2021-05-14 15:08:39 +02:00
parent 22b3a73db3
commit 5abd4979a3
3 changed files with 28 additions and 0 deletions

View File

@ -27,6 +27,13 @@ pub fn get_admin_keys(id: AdminID) -> Res<Vec<AdminKey>> {
.exec(db_to_admin_key)
}
/// Remove a key from the database
pub fn delete_key(key: AdminKey) -> Res {
database::DeleteQuery::new(ADMIN_KEYS_TABLE)
.cond_u64("id", key.id)
.exec()
}
/// Turn database entry into an AdminKey structure
fn db_to_admin_key(row: &database::RowResult) -> Res<AdminKey> {
Ok(AdminKey {