3 Commits

Author SHA1 Message Date
d2d6852f31 removed comment
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m29s
Pull Request Pipeline / lint (pull_request) Successful in 2m51s
2025-11-28 14:00:26 +01:00
126dc7ed97 Added exception 2025-11-28 14:00:04 +01:00
40a3c1b82e Removed comment 2025-11-28 13:56:24 +01:00
2 changed files with 4 additions and 3 deletions

View File

@@ -65,7 +65,6 @@ class GameDao extends DatabaseAccessor<AppDatabase> with _$GameDaoMixin {
/// Adds a new [Game] to the database. /// Adds a new [Game] to the database.
/// Also adds associated players and group if they exist. /// Also adds associated players and group if they exist.
/// If a game, player, or group already exists, it will be replaced.
Future<void> addGame({required Game game}) async { Future<void> addGame({required Game game}) async {
await db.transaction(() async { await db.transaction(() async {
await into(gameTable).insert( await into(gameTable).insert(

View File

@@ -11,12 +11,14 @@ class GroupGameDao extends DatabaseAccessor<AppDatabase>
GroupGameDao(super.db); GroupGameDao(super.db);
/// Associates a group with a game by inserting a record into the /// Associates a group with a game by inserting a record into the
/// [GroupGameTable]. If there is already group associated to the game, /// [GroupGameTable].
/// it will be replaced.
Future<void> addGroupToGame({ Future<void> addGroupToGame({
required String gameId, required String gameId,
required String groupId, required String groupId,
}) async { }) async {
if (await gameHasGroup(gameId: gameId)) {
throw Exception('Game already has a group');
}
await into(groupGameTable).insert( await into(groupGameTable).insert(
GroupGameTableCompanion.insert(groupId: groupId, gameId: gameId), GroupGameTableCompanion.insert(groupId: groupId, gameId: gameId),
mode: InsertMode.insertOrReplace, mode: InsertMode.insertOrReplace,