Game Prize and Logout
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
part of '../game.dart';
|
||||
|
||||
@freezed
|
||||
class Game with _$Game {
|
||||
const factory Game({
|
||||
required String id,
|
||||
required String name,
|
||||
required String type,
|
||||
required bool isActive,
|
||||
required Map<String, dynamic> metadata,
|
||||
required String createdAt,
|
||||
required String updatedAt,
|
||||
}) = _Game;
|
||||
|
||||
factory Game.empty() => const Game(
|
||||
id: '',
|
||||
name: '',
|
||||
type: '',
|
||||
isActive: false,
|
||||
metadata: {},
|
||||
createdAt: '',
|
||||
updatedAt: '',
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
part of '../game.dart';
|
||||
|
||||
@freezed
|
||||
class GamePrize with _$GamePrize {
|
||||
const factory GamePrize({
|
||||
required String id,
|
||||
required String gameId,
|
||||
required String name,
|
||||
required int weight,
|
||||
required int stock,
|
||||
required int maxStock,
|
||||
required int threshold,
|
||||
required Map<String, dynamic> metadata,
|
||||
required Game game,
|
||||
required String createdAt,
|
||||
required String updatedAt,
|
||||
}) = _GamePrize;
|
||||
|
||||
factory GamePrize.empty() => GamePrize(
|
||||
id: '',
|
||||
gameId: '',
|
||||
name: '',
|
||||
weight: 0,
|
||||
stock: 0,
|
||||
maxStock: 0,
|
||||
threshold: 0,
|
||||
metadata: const {},
|
||||
game: Game.empty(),
|
||||
createdAt: '',
|
||||
updatedAt: '',
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
part of '../game.dart';
|
||||
|
||||
@freezed
|
||||
sealed class GameFailure with _$GameFailure {
|
||||
const factory GameFailure.serverError(ApiFailure failure) = _ServerError;
|
||||
const factory GameFailure.unexpectedError() = _UnexpectedError;
|
||||
const factory GameFailure.dynamicErrorMessage(String erroMessage) =
|
||||
_DynamicErrorMessage;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../../common/api/api_failure.dart';
|
||||
|
||||
part 'game.freezed.dart';
|
||||
|
||||
part 'entity/game_entity.dart';
|
||||
part 'entity/game_prize_entity.dart';
|
||||
part 'failures/game_failure.dart';
|
||||
part 'repositories/i_game_repository.dart';
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
part of '../game.dart';
|
||||
|
||||
abstract class IGameRepository {
|
||||
Future<Either<GameFailure, List<GamePrize>>> gamePrizeByGameId({
|
||||
required String id,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user