84 lines
2.1 KiB
Dart
84 lines
2.1 KiB
Dart
class AuthModel {
|
|
final String token;
|
|
final String host;
|
|
final UserModel model;
|
|
|
|
AuthModel({
|
|
required this.host,
|
|
required this.token,
|
|
required this.model,
|
|
});
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'host':host,
|
|
'token': token,
|
|
'model': model.toJson(),
|
|
};
|
|
}
|
|
}
|
|
|
|
class UserModel {
|
|
final String userId;
|
|
final String username;
|
|
final String groupDashboard;
|
|
final String defaultSampleStationId;
|
|
final String staffName;
|
|
final String isCourier;
|
|
final String timeAutoLogout;
|
|
final String ip;
|
|
final String agent;
|
|
final String version;
|
|
final String lastLogin;
|
|
final int satelliteId;
|
|
|
|
UserModel({
|
|
required this.userId,
|
|
required this.username,
|
|
required this.groupDashboard,
|
|
required this.defaultSampleStationId,
|
|
required this.staffName,
|
|
required this.isCourier,
|
|
required this.timeAutoLogout,
|
|
required this.ip,
|
|
required this.agent,
|
|
required this.version,
|
|
required this.lastLogin,
|
|
required this.satelliteId,
|
|
});
|
|
|
|
factory UserModel.fromJson(Map<String, dynamic> json) {
|
|
return UserModel(
|
|
userId: json['M_UserID'] ?? '',
|
|
username: json['M_UserUsername'] ?? '',
|
|
groupDashboard: json['M_UserGroupDashboard'] ?? '',
|
|
defaultSampleStationId: json['M_UserDefaultT_SampleStationID'] ?? '',
|
|
staffName: json['M_StaffName'] ?? '',
|
|
isCourier: json['is_courier'] ?? '',
|
|
timeAutoLogout: json['time_autologout'] ?? '',
|
|
ip: json['ip'] ?? '',
|
|
agent: json['agent'] ?? '',
|
|
version: json['version'] ?? '',
|
|
lastLogin: json['last-login'] ?? '',
|
|
satelliteId: json['M_SatelliteID'] ?? 0,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'M_UserID': userId,
|
|
'M_UserUsername': username,
|
|
'M_UserGroupDashboard': groupDashboard,
|
|
'M_UserDefaultT_SampleStationID': defaultSampleStationId,
|
|
'M_StaffName': staffName,
|
|
'is_courier': isCourier,
|
|
'time_autologout': timeAutoLogout,
|
|
'ip': ip,
|
|
'agent': agent,
|
|
'version': version,
|
|
'last-login': lastLogin,
|
|
'M_SatelliteID': satelliteId,
|
|
};
|
|
}
|
|
}
|