1111
This commit is contained in:
54
lib/data/dto/vacations_list_response_dto.dart
Normal file
54
lib/data/dto/vacations_list_response_dto.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
import 'vacation_response_dto.dart';
|
||||
|
||||
class VacationsListResponseDto {
|
||||
final int statusCode;
|
||||
final bool isSuccess;
|
||||
final String? message;
|
||||
final VacationsListDataDto? data;
|
||||
|
||||
VacationsListResponseDto({
|
||||
required this.statusCode,
|
||||
required this.isSuccess,
|
||||
this.message,
|
||||
this.data,
|
||||
});
|
||||
|
||||
factory VacationsListResponseDto.fromJson(Map<String, dynamic> json) {
|
||||
return VacationsListResponseDto(
|
||||
statusCode: json['statusCode'] ?? 0,
|
||||
isSuccess: json['isSuccess'] ?? false,
|
||||
message: json['message'],
|
||||
data: json['data'] != null ? VacationsListDataDto.fromJson(json['data']) : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class VacationsListDataDto {
|
||||
final List<VacationDataDto> items;
|
||||
final int pageNumber;
|
||||
final int pageSize;
|
||||
final int totalCount;
|
||||
final int totalPages;
|
||||
|
||||
VacationsListDataDto({
|
||||
required this.items,
|
||||
required this.pageNumber,
|
||||
required this.pageSize,
|
||||
required this.totalCount,
|
||||
required this.totalPages,
|
||||
});
|
||||
|
||||
factory VacationsListDataDto.fromJson(Map<String, dynamic> json) {
|
||||
return VacationsListDataDto(
|
||||
items: json['items'] != null
|
||||
? (json['items'] as List)
|
||||
.map((item) => VacationDataDto.fromJson(item))
|
||||
.toList()
|
||||
: [],
|
||||
pageNumber: json['pageNumber'] ?? 1,
|
||||
pageSize: json['pageSize'] ?? 15,
|
||||
totalCount: json['totalCount'] ?? 0,
|
||||
totalPages: json['totalPages'] ?? 1,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user