color is now a required game parameter

This commit is contained in:
gelbeinhalb
2026-01-23 11:08:11 +01:00
parent 6006c6d3f7
commit 55f5aac4e2
11 changed files with 51 additions and 61 deletions

View File

@@ -20,7 +20,7 @@ class GameDao extends DatabaseAccessor<AppDatabase> with _$GameDaoMixin {
name: row.name,
ruleset: row.ruleset,
description: row.description,
color: row.color != null ? int.tryParse(row.color!) : null,
color: row.color,
icon: row.icon,
createdAt: row.createdAt,
),
@@ -37,7 +37,7 @@ class GameDao extends DatabaseAccessor<AppDatabase> with _$GameDaoMixin {
name: result.name,
ruleset: result.ruleset,
description: result.description,
color: result.color != null ? int.tryParse(result.color!) : null,
color: result.color,
icon: result.icon,
createdAt: result.createdAt,
);
@@ -54,7 +54,7 @@ class GameDao extends DatabaseAccessor<AppDatabase> with _$GameDaoMixin {
name: game.name,
ruleset: game.ruleset ?? '',
description: Value(game.description),
color: Value(game.color?.toString()),
color: game.color,
icon: Value(game.icon),
createdAt: game.createdAt,
),
@@ -80,7 +80,7 @@ class GameDao extends DatabaseAccessor<AppDatabase> with _$GameDaoMixin {
name: game.name,
ruleset: game.ruleset ?? '',
description: Value(game.description),
color: Value(game.color?.toString()),
color: game.color,
icon: Value(game.icon),
createdAt: game.createdAt,
),
@@ -142,10 +142,10 @@ class GameDao extends DatabaseAccessor<AppDatabase> with _$GameDaoMixin {
/// Updates the color of the game with the given [gameId].
Future<void> updateGameColor({
required String gameId,
required int? newColor,
required String newColor,
}) async {
await (update(gameTable)..where((g) => g.id.equals(gameId))).write(
GameTableCompanion(color: Value(newColor?.toString())),
GameTableCompanion(color: Value(newColor)),
);
}

View File

@@ -129,7 +129,7 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
name: game.name,
ruleset: game.ruleset ?? '',
description: Value(game.description),
color: Value(game.color?.toString()),
color: game.color,
icon: Value(game.icon),
createdAt: game.createdAt,
),