35 lines
1014 B
Dart
35 lines
1014 B
Dart
part of '../customer_dtos.dart';
|
|
|
|
@freezed
|
|
class CustomerPointDto with _$CustomerPointDto {
|
|
const factory CustomerPointDto({
|
|
@JsonKey(name: 'status') String? status,
|
|
@JsonKey(name: 'message') String? message,
|
|
@JsonKey(name: 'data') CustomerPointDataDto? data,
|
|
}) = _CustomerPointDto;
|
|
|
|
factory CustomerPointDto.fromJson(Map<String, dynamic> json) =>
|
|
_$CustomerPointDtoFromJson(json);
|
|
|
|
const CustomerPointDto._();
|
|
|
|
/// mapping ke domain
|
|
CustomerPoint toDomain() => CustomerPoint(
|
|
status: status ?? '',
|
|
message: message ?? '',
|
|
totalPoints: data?.totalPoints ?? 0,
|
|
lastUpdated: data?.lastUpdated ?? '',
|
|
);
|
|
}
|
|
|
|
@freezed
|
|
class CustomerPointDataDto with _$CustomerPointDataDto {
|
|
const factory CustomerPointDataDto({
|
|
@JsonKey(name: 'total_points') int? totalPoints,
|
|
@JsonKey(name: 'last_updated') String? lastUpdated,
|
|
}) = _CustomerPointDataDto;
|
|
|
|
factory CustomerPointDataDto.fromJson(Map<String, dynamic> json) =>
|
|
_$CustomerPointDataDtoFromJson(json);
|
|
}
|