Daily commit
This commit is contained in:
25
lib/dto/car_dto.dart
Normal file
25
lib/dto/car_dto.dart
Normal file
@ -0,0 +1,25 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'car_dto.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class CarDTO {
|
||||
@JsonKey(name: 'id')
|
||||
final int id;
|
||||
|
||||
@JsonKey(name: 'driver_name')
|
||||
final String? driverName;
|
||||
|
||||
@JsonKey(name: 'car_name')
|
||||
final String carName;
|
||||
|
||||
CarDTO({
|
||||
required this.id,
|
||||
required this.carName,
|
||||
required this.driverName,
|
||||
});
|
||||
|
||||
factory CarDTO.fromJson(Map<String, dynamic> json) => _$CarDTOFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$CarDTOToJson(this);
|
||||
}
|
||||
19
lib/dto/car_dto.g.dart
Normal file
19
lib/dto/car_dto.g.dart
Normal file
@ -0,0 +1,19 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'car_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
CarDTO _$CarDTOFromJson(Map<String, dynamic> json) => CarDTO(
|
||||
id: (json['id'] as num).toInt(),
|
||||
carName: json['car_name'] as String,
|
||||
driverName: json['driver_name'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CarDTOToJson(CarDTO instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'driver_name': instance.driverName,
|
||||
'car_name': instance.carName,
|
||||
};
|
||||
20
lib/dto/delivery_dto.dart
Normal file
20
lib/dto/delivery_dto.dart
Normal file
@ -0,0 +1,20 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'car_dto.dart';
|
||||
|
||||
part 'delivery_dto.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class DeliveryDTO {
|
||||
@JsonKey(name: 'amount_deliveries')
|
||||
final int amountDeliveries;
|
||||
|
||||
final CarDTO car;
|
||||
|
||||
DeliveryDTO({
|
||||
required this.amountDeliveries,
|
||||
required this.car,
|
||||
});
|
||||
|
||||
factory DeliveryDTO.fromJson(Map<String, dynamic> json) => _$DeliveryDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$DeliveryDTOToJson(this);
|
||||
}
|
||||
18
lib/dto/delivery_dto.g.dart
Normal file
18
lib/dto/delivery_dto.g.dart
Normal file
@ -0,0 +1,18 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'delivery_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
DeliveryDTO _$DeliveryDTOFromJson(Map<String, dynamic> json) => DeliveryDTO(
|
||||
amountDeliveries: (json['amount_deliveries'] as num).toInt(),
|
||||
car: CarDTO.fromJson(json['car'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$DeliveryDTOToJson(DeliveryDTO instance) =>
|
||||
<String, dynamic>{
|
||||
'amount_deliveries': instance.amountDeliveries,
|
||||
'car': instance.car.toJson(),
|
||||
};
|
||||
14
lib/dto/fail_response_dto.dart
Normal file
14
lib/dto/fail_response_dto.dart
Normal file
@ -0,0 +1,14 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'fail_response_dto.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class FailResponseDTO {
|
||||
int? code;
|
||||
String message;
|
||||
|
||||
FailResponseDTO({required this.message, required this.code});
|
||||
|
||||
factory FailResponseDTO.fromJson(Map<String, dynamic> json) => _$FailResponseDTOFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$FailResponseDTOToJson(this);
|
||||
}
|
||||
16
lib/dto/fail_response_dto.g.dart
Normal file
16
lib/dto/fail_response_dto.g.dart
Normal file
@ -0,0 +1,16 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'fail_response_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
FailResponseDTO _$FailResponseDTOFromJson(Map<String, dynamic> json) =>
|
||||
FailResponseDTO(
|
||||
message: json['message'] as String,
|
||||
code: (json['code'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$FailResponseDTOToJson(FailResponseDTO instance) =>
|
||||
<String, dynamic>{'code': instance.code, 'message': instance.message};
|
||||
19
lib/dto/get_deliveries_dto.dart
Normal file
19
lib/dto/get_deliveries_dto.dart
Normal file
@ -0,0 +1,19 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'delivery_dto.dart';
|
||||
|
||||
part 'get_deliveries_dto.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GetDeliveriesDTO {
|
||||
final List<DeliveryDTO> deliveries;
|
||||
final String date;
|
||||
|
||||
GetDeliveriesDTO({
|
||||
required this.deliveries,
|
||||
required this.date
|
||||
});
|
||||
|
||||
factory GetDeliveriesDTO.fromJson(Map<String, dynamic> json) => _$GetDeliveriesDTOFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$GetDeliveriesDTOToJson(this);
|
||||
}
|
||||
21
lib/dto/get_deliveries_dto.g.dart
Normal file
21
lib/dto/get_deliveries_dto.g.dart
Normal file
@ -0,0 +1,21 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'get_deliveries_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
GetDeliveriesDTO _$GetDeliveriesDTOFromJson(Map<String, dynamic> json) =>
|
||||
GetDeliveriesDTO(
|
||||
deliveries: (json['deliveries'] as List<dynamic>)
|
||||
.map((e) => DeliveryDTO.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
date: json['date'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$GetDeliveriesDTOToJson(GetDeliveriesDTO instance) =>
|
||||
<String, dynamic>{
|
||||
'deliveries': instance.deliveries.map((e) => e.toJson()).toList(),
|
||||
'date': instance.date,
|
||||
};
|
||||
Reference in New Issue
Block a user