Customer Point

This commit is contained in:
efrilm
2025-09-18 13:01:31 +07:00
parent a5d66c63b7
commit 73918430b2
22 changed files with 1970 additions and 98 deletions
@@ -0,0 +1,34 @@
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);
}