update staff list, add pin editor and privilege editor

This commit is contained in:
tzw
2024-02-14 16:58:45 +06:30
parent 106ddded29
commit 13e6e232d5
20 changed files with 770 additions and 113 deletions

View File

@@ -106,4 +106,29 @@ class StaffModel extends BaseModel {
}
return users;
}
Future<User?> getUser(String userID) async {
if (userID == "") return null;
String path = "/$user_collection";
try {
var snap = await FirebaseFirestore.instance
.collection(path)
.doc(userID)
.get(const GetOptions(source: Source.server));
if (snap.data() == null) return null;
Map<String, dynamic>? data = snap.data() as Map<String, dynamic>;
if (data['delete_time'] == 0) {
User user = User.fromMap(data, snap.id);
return user;
} else {
return null;
}
} catch (e) {
log.warning("Error!! $e");
}
return null;
}
}