MVP #141

Merged
flixcoo merged 705 commits from development into main 2026-01-09 12:55:50 +00:00
Showing only changes of commit 74402f2e04 - Show all commits

View File

@@ -26,14 +26,14 @@ class PlayerDao extends DatabaseAccessor<AppDatabase> with _$PlayerDaoMixin {
/// Adds a new [player] to the database. /// Adds a new [player] to the database.
/// If a player with the same ID already exists, updates their name to /// If a player with the same ID already exists, updates their name to
/// the new one. /// the new one.
Future<void> addPlayer({required Player player}) async { Future<bool> addPlayer({required Player player}) async {
if (!await playerExists(playerId: player.id)) { if (!await playerExists(playerId: player.id)) {
await into( await into(
playerTable, playerTable,
).insert(PlayerTableCompanion.insert(id: player.id, name: player.name)); ).insert(PlayerTableCompanion.insert(id: player.id, name: player.name));
} else { return true;
await updatePlayername(playerId: player.id, newName: player.name);
} }
return false;
} }
/// Deletes the player with the given [id] from the database. /// Deletes the player with the given [id] from the database.