1111
This commit is contained in:
16
lib/data/dto/login_dto.dart
Normal file
16
lib/data/dto/login_dto.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
class LoginDto {
|
||||
final String phoneNumber;
|
||||
final String password;
|
||||
|
||||
LoginDto({
|
||||
required this.phoneNumber,
|
||||
required this.password,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'phoneNumber': phoneNumber,
|
||||
'password': password,
|
||||
};
|
||||
}
|
||||
}
|
||||
85
lib/data/dto/login_response_dto.dart
Normal file
85
lib/data/dto/login_response_dto.dart
Normal file
@@ -0,0 +1,85 @@
|
||||
class LoginResponseDto {
|
||||
final int statusCode;
|
||||
final bool isSuccess;
|
||||
final String message;
|
||||
final LoginDataDto? data;
|
||||
|
||||
LoginResponseDto({
|
||||
required this.statusCode,
|
||||
required this.isSuccess,
|
||||
required this.message,
|
||||
this.data,
|
||||
});
|
||||
|
||||
factory LoginResponseDto.fromJson(Map<String, dynamic> json) {
|
||||
return LoginResponseDto(
|
||||
statusCode: json['statusCode'] ?? 0,
|
||||
isSuccess: json['isSuccess'] ?? false,
|
||||
message: json['message'] ?? '',
|
||||
data: json['data'] != null ? LoginDataDto.fromJson(json['data']) : null,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'statusCode': statusCode,
|
||||
'isSuccess': isSuccess,
|
||||
'message': message,
|
||||
'data': data?.toJson(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class LoginDataDto {
|
||||
final String? token;
|
||||
final String? id;
|
||||
final String? employeeId;
|
||||
final String? username;
|
||||
final String? fullName;
|
||||
final String? role;
|
||||
final String? email;
|
||||
final String? phoneNumber;
|
||||
final List<String>? permissions;
|
||||
|
||||
LoginDataDto({
|
||||
this.token,
|
||||
this.id,
|
||||
this.employeeId,
|
||||
this.username,
|
||||
this.fullName,
|
||||
this.role,
|
||||
this.email,
|
||||
this.phoneNumber,
|
||||
this.permissions,
|
||||
});
|
||||
|
||||
factory LoginDataDto.fromJson(Map<String, dynamic> json) {
|
||||
return LoginDataDto(
|
||||
token: json['token'],
|
||||
id: json['id'],
|
||||
employeeId: json['employeeId'],
|
||||
username: json['username'],
|
||||
fullName: json['fullName'],
|
||||
role: json['role'],
|
||||
email: json['email'],
|
||||
phoneNumber: json['phoneNumber'],
|
||||
permissions: json['permissions'] != null
|
||||
? List<String>.from(json['permissions'])
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'token': token,
|
||||
'id': id,
|
||||
'employeeId': employeeId,
|
||||
'username': username,
|
||||
'fullName': fullName,
|
||||
'role': role,
|
||||
'email': email,
|
||||
'phoneNumber': phoneNumber,
|
||||
'permissions': permissions,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user