Moved dao methods

This commit is contained in:
2026-04-08 23:22:41 +02:00
parent 855b7c8bea
commit 6a49b92310
4 changed files with 24 additions and 34 deletions

View File

@@ -44,22 +44,6 @@ class PlayerMatchDao extends DatabaseAccessor<AppDatabase>
return players;
}
/// Updates the score for a player in a match.
/// Returns `true` if the update was successful, otherwise `false`.
Future<bool> updatePlayerScore({
required String matchId,
required String playerId,
required int newScore,
}) async {
/* final rowsAffected =
await (update(playerMatchTable)..where(
(p) => p.matchId.equals(matchId) & p.playerId.equals(playerId),
))
.write(PlayerMatchTableCompanion(score: Value(newScore)));
return rowsAffected > 0;*/
return false;
}
/// Updates the team for a player in a match.
/// Returns `true` if the update was successful, otherwise `false`.
Future<bool> updatePlayerTeam({

View File

@@ -14,9 +14,9 @@ class ScoreDao extends DatabaseAccessor<AppDatabase> with _$ScoreDaoMixin {
Future<void> addScore({
required String playerId,
required String matchId,
required int roundNumber,
required int score,
required int change,
int change = 0,
int roundNumber = 0,
}) async {
await into(scoreTable).insert(
ScoreTableCompanion.insert(
@@ -97,9 +97,9 @@ class ScoreDao extends DatabaseAccessor<AppDatabase> with _$ScoreDaoMixin {
Future<bool> updateScore({
required String playerId,
required String matchId,
required int roundNumber,
required int newScore,
required int newChange,
int newChange = 0,
int roundNumber = 0,
}) async {
final rowsAffected =
await (update(scoreTable)..where(
@@ -121,7 +121,7 @@ class ScoreDao extends DatabaseAccessor<AppDatabase> with _$ScoreDaoMixin {
Future<bool> deleteScore({
required String playerId,
required String matchId,
required int roundNumber,
int roundNumber = 0,
}) async {
final query = delete(scoreTable)
..where(