1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 16:35:17 +00:00

Update get_admin_info route

This commit is contained in:
2021-05-13 08:42:59 +02:00
parent add56a9a6d
commit 830c6d0700
3 changed files with 37 additions and 3 deletions

View File

@ -24,6 +24,14 @@ pub fn create(new_admin: &NewAdmin) -> Res<AdminID> {
.map(|i| AdminID::new(i))
}
/// Check out whether an admin exists or not
pub fn exists(id: AdminID) -> Res<bool> {
database::QueryInfo::new(ADMIN_LIST_TABLE)
.cond_admin_id("id", id)
.exec_count()
.map(|r| r > 0)
}
/// Get admin information by ID
pub fn find_admin_by_id(id: AdminID) -> Res<Admin> {
database::QueryInfo::new(ADMIN_LIST_TABLE)