cleanup and added unit tests
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:fotodocumentation/dto/picture_dto.dart';
|
||||
import 'package:fotodocumentation/utils/date_time_utils.dart';
|
||||
|
||||
class CustomerListDto {
|
||||
@@ -38,28 +39,4 @@ class CustomerDto {
|
||||
}
|
||||
}
|
||||
|
||||
class PictureDto {
|
||||
final int id;
|
||||
final String? comment;
|
||||
final String? category;
|
||||
final String image;
|
||||
final DateTime pictureDate;
|
||||
final String? username;
|
||||
final CustomerListDto customerListDto;
|
||||
|
||||
PictureDto(
|
||||
{required this.id, required this.comment, required this.category, required this.image, required this.pictureDate, required this.username, required this.customerListDto});
|
||||
|
||||
/// Create from JSON response
|
||||
factory PictureDto.fromJson(Map<String, dynamic> json) {
|
||||
return PictureDto(
|
||||
id: json['id'] as int,
|
||||
comment: json['comment'] as String?,
|
||||
category: json['category'] as String?,
|
||||
image: json['image'] as String,
|
||||
pictureDate: DateTimeUtils.toDateTime(json['pictureDate']) ?? DateTime.now(),
|
||||
username: json['username'] as String?,
|
||||
customerListDto: CustomerListDto.fromJson(json['customer']),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user