mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-21 08:55:16 +00:00
Can get admin information
This commit is contained in:
@ -24,6 +24,12 @@ pub fn create(new_admin: &NewAdmin) -> Res<AdminID> {
|
||||
.map(|i| AdminID::new(i))
|
||||
}
|
||||
|
||||
/// Get admin information by ID
|
||||
pub fn find_admin_by_id(id: AdminID) -> Res<Admin> {
|
||||
database::QueryInfo::new(ADMIN_LIST_TABLE)
|
||||
.cond_admin_id("id", id)
|
||||
.query_row(db_to_admin)
|
||||
}
|
||||
|
||||
/// Get admin information by admin email address
|
||||
pub fn find_admin_by_email(email: &str) -> Res<Admin> {
|
||||
|
@ -171,6 +171,11 @@ impl QueryInfo {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn cond_admin_id(mut self, key: &str, val: AdminID) -> QueryInfo {
|
||||
self.conditions.insert(key.to_string(), mysql::Value::from(val.id()));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn cond_group_id(mut self, key: &str, val: &GroupID) -> QueryInfo {
|
||||
self.conditions.insert(key.to_string(), mysql::Value::from(val.id()));
|
||||
self
|
||||
|
Reference in New Issue
Block a user