clean up
This commit is contained in:
67
lib/domain/entities/role.dart
Normal file
67
lib/domain/entities/role.dart
Normal file
@@ -0,0 +1,67 @@
|
||||
class Role {
|
||||
String roleID;
|
||||
String roleName;
|
||||
String privileges;
|
||||
Role({this.roleName, this.roleID, this.privileges});
|
||||
|
||||
Role.fromJson(Map<String, dynamic> json) {
|
||||
roleName = json['role_name'];
|
||||
roleID = json['role_id'];
|
||||
privileges = json['privileges'];
|
||||
}
|
||||
}
|
||||
|
||||
class Parser {
|
||||
String status;
|
||||
String message;
|
||||
Role data;
|
||||
Parser({this.status, this.message, this.data});
|
||||
|
||||
Parser.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
message = json['message'];
|
||||
if (json['status'] == 'Ok') {
|
||||
data = Role.fromJson(json['data']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class StatusParser {
|
||||
String status;
|
||||
String message;
|
||||
StatusParser(this.status, this.message);
|
||||
|
||||
StatusParser.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
message = json['message'];
|
||||
}
|
||||
}
|
||||
|
||||
class Privilege {
|
||||
String id;
|
||||
String name;
|
||||
String desc;
|
||||
bool sysAdminOnly = true;
|
||||
bool isChecked = false;
|
||||
|
||||
Privilege({this.id, this.name, this.desc, this.isChecked, this.sysAdminOnly});
|
||||
|
||||
factory Privilege.fromMap(Map<String, dynamic> map, String docID) {
|
||||
return Privilege(
|
||||
id: docID,
|
||||
name: map['name'],
|
||||
desc: map['desc'],
|
||||
sysAdminOnly: map['sys_admin_only']);
|
||||
}
|
||||
}
|
||||
|
||||
class UserLevel {
|
||||
String id;
|
||||
String name;
|
||||
int level;
|
||||
UserLevel({this.id, this.name, this.level});
|
||||
|
||||
factory UserLevel.fromMap(Map<String, dynamic> map, String docID) {
|
||||
return UserLevel(id: docID, name: map['name'], level: map['level']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user