Ferish Wheel and Music
This commit is contained in:
@@ -8,6 +8,7 @@ class GameDto with _$GameDto {
|
||||
@JsonKey(name: 'type') String? type,
|
||||
@JsonKey(name: 'is_active') bool? isActive,
|
||||
@JsonKey(name: 'metadata') Map<String, dynamic>? metadata,
|
||||
@JsonKey(name: 'prizes') List<GamePrizeDto>? prizes,
|
||||
@JsonKey(name: 'created_at') String? createdAt,
|
||||
@JsonKey(name: 'updated_at') String? updatedAt,
|
||||
}) = _GameDto;
|
||||
@@ -22,7 +23,8 @@ class GameDto with _$GameDto {
|
||||
name: name ?? '',
|
||||
type: type ?? '',
|
||||
isActive: isActive ?? false,
|
||||
metadata: metadata ?? const {},
|
||||
metadata: metadata ?? {},
|
||||
prizes: prizes?.map((e) => e.toDomain()).toList() ?? [],
|
||||
createdAt: createdAt ?? '',
|
||||
updatedAt: updatedAt ?? '',
|
||||
);
|
||||
|
||||
@@ -6,12 +6,7 @@ class GamePrizeDto with _$GamePrizeDto {
|
||||
@JsonKey(name: 'id') String? id,
|
||||
@JsonKey(name: 'game_id') String? gameId,
|
||||
@JsonKey(name: 'name') String? name,
|
||||
@JsonKey(name: 'weight') int? weight,
|
||||
@JsonKey(name: 'stock') int? stock,
|
||||
@JsonKey(name: 'max_stock') int? maxStock,
|
||||
@JsonKey(name: 'threshold') int? threshold,
|
||||
@JsonKey(name: 'metadata') Map<String, dynamic>? metadata,
|
||||
@JsonKey(name: 'game') GameDto? game,
|
||||
@JsonKey(name: 'created_at') String? createdAt,
|
||||
@JsonKey(name: 'updated_at') String? updatedAt,
|
||||
}) = _GamePrizeDto;
|
||||
@@ -21,17 +16,11 @@ class GamePrizeDto with _$GamePrizeDto {
|
||||
|
||||
const GamePrizeDto._();
|
||||
|
||||
/// mapping ke domain
|
||||
GamePrize toDomain() => GamePrize(
|
||||
id: id ?? '',
|
||||
gameId: gameId ?? '',
|
||||
name: name ?? '',
|
||||
weight: weight ?? 0,
|
||||
stock: stock ?? 0,
|
||||
maxStock: maxStock ?? 0,
|
||||
threshold: threshold ?? 0,
|
||||
metadata: metadata ?? const {},
|
||||
game: game?.toDomain() ?? Game.empty(),
|
||||
metadata: metadata ?? {},
|
||||
createdAt: createdAt ?? '',
|
||||
updatedAt: updatedAt ?? '',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user