fix errors after merging
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/database.dart';
|
||||
import 'package:game_tracker/data/db/tables/game_table.dart';
|
||||
import 'package:game_tracker/data/dto/game.dart';
|
||||
import 'package:game_tracker/core/enums.dart';
|
||||
import 'package:tallee/data/db/database.dart';
|
||||
import 'package:tallee/data/db/tables/game_table.dart';
|
||||
import 'package:tallee/data/dto/game.dart';
|
||||
import 'package:tallee/core/enums.dart';
|
||||
|
||||
part 'game_dao.g.dart';
|
||||
|
||||
@@ -111,20 +111,14 @@ class GameDao extends DatabaseAccessor<AppDatabase> with _$GameDaoMixin {
|
||||
}
|
||||
|
||||
/// Updates the name of the game with the given [gameId] to [newName].
|
||||
Future<void> updateGameName({
|
||||
required String gameId,
|
||||
required String newName,
|
||||
}) async {
|
||||
await (update(gameTable)..where((g) => g.id.equals(gameId))).write(
|
||||
GameTableCompanion(name: Value(newName)),
|
||||
);
|
||||
Future<void> updateGameName({required String gameId, required String newName}) async {
|
||||
await (update(
|
||||
gameTable,
|
||||
)..where((g) => g.id.equals(gameId))).write(GameTableCompanion(name: Value(newName)));
|
||||
}
|
||||
|
||||
/// Updates the ruleset of the game with the given [gameId].
|
||||
Future<void> updateGameRuleset({
|
||||
required String gameId,
|
||||
required Ruleset newRuleset,
|
||||
}) async {
|
||||
Future<void> updateGameRuleset({required String gameId, required Ruleset newRuleset}) async {
|
||||
await (update(gameTable)..where((g) => g.id.equals(gameId))).write(
|
||||
GameTableCompanion(ruleset: Value(newRuleset.name)),
|
||||
);
|
||||
@@ -141,31 +135,24 @@ class GameDao extends DatabaseAccessor<AppDatabase> with _$GameDaoMixin {
|
||||
}
|
||||
|
||||
/// Updates the color of the game with the given [gameId].
|
||||
Future<void> updateGameColor({
|
||||
required String gameId,
|
||||
required String newColor,
|
||||
}) async {
|
||||
await (update(gameTable)..where((g) => g.id.equals(gameId))).write(
|
||||
GameTableCompanion(color: Value(newColor)),
|
||||
);
|
||||
Future<void> updateGameColor({required String gameId, required String newColor}) async {
|
||||
await (update(
|
||||
gameTable,
|
||||
)..where((g) => g.id.equals(gameId))).write(GameTableCompanion(color: Value(newColor)));
|
||||
}
|
||||
|
||||
/// Updates the icon of the game with the given [gameId].
|
||||
Future<void> updateGameIcon({
|
||||
required String gameId,
|
||||
required String newIcon,
|
||||
}) async {
|
||||
await (update(gameTable)..where((g) => g.id.equals(gameId))).write(
|
||||
GameTableCompanion(icon: Value(newIcon)),
|
||||
);
|
||||
Future<void> updateGameIcon({required String gameId, required String newIcon}) async {
|
||||
await (update(
|
||||
gameTable,
|
||||
)..where((g) => g.id.equals(gameId))).write(GameTableCompanion(icon: Value(newIcon)));
|
||||
}
|
||||
|
||||
/// Retrieves the total count of games in the database.
|
||||
Future<int> getGameCount() async {
|
||||
final count =
|
||||
await (selectOnly(gameTable)..addColumns([gameTable.id.count()]))
|
||||
.map((row) => row.read(gameTable.id.count()))
|
||||
.getSingle();
|
||||
final count = await (selectOnly(
|
||||
gameTable,
|
||||
)..addColumns([gameTable.id.count()])).map((row) => row.read(gameTable.id.count())).getSingle();
|
||||
return count ?? 0;
|
||||
}
|
||||
|
||||
@@ -177,4 +164,3 @@ class GameDao extends DatabaseAccessor<AppDatabase> with _$GameDaoMixin {
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:tallee/data/db/database.dart';
|
||||
import 'package:tallee/data/db/tables/game_table.dart';
|
||||
import 'package:tallee/data/db/tables/group_table.dart';
|
||||
import 'package:tallee/data/db/tables/match_table.dart';
|
||||
import 'package:tallee/data/db/tables/player_match_table.dart';
|
||||
import 'package:tallee/data/dto/game.dart';
|
||||
import 'package:tallee/data/dto/group.dart';
|
||||
import 'package:tallee/data/dto/match.dart';
|
||||
import 'package:tallee/data/dto/player.dart';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:tallee/data/db/database.dart';
|
||||
import 'package:tallee/data/db/tables/player_match_table.dart';
|
||||
import 'package:tallee/data/db/tables/team_table.dart';
|
||||
import 'package:tallee/data/dto/player.dart';
|
||||
|
||||
part 'player_match_dao.g.dart';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/database.dart';
|
||||
import 'package:game_tracker/data/db/tables/score_table.dart';
|
||||
import 'package:tallee/data/db/database.dart';
|
||||
import 'package:tallee/data/db/tables/score_table.dart';
|
||||
|
||||
part 'score_dao.g.dart';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/database.dart';
|
||||
import 'package:game_tracker/data/db/tables/team_table.dart';
|
||||
import 'package:game_tracker/data/dto/player.dart';
|
||||
import 'package:game_tracker/data/dto/team.dart';
|
||||
import 'package:tallee/data/db/database.dart';
|
||||
import 'package:tallee/data/db/tables/team_table.dart';
|
||||
import 'package:tallee/data/dto/player.dart';
|
||||
import 'package:tallee/data/dto/team.dart';
|
||||
|
||||
part 'team_dao.g.dart';
|
||||
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:drift_flutter/drift_flutter.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:tallee/data/dao/game_dao.dart';
|
||||
import 'package:tallee/data/dao/group_dao.dart';
|
||||
import 'package:tallee/data/dao/group_match_dao.dart';
|
||||
import 'package:tallee/data/dao/match_dao.dart';
|
||||
import 'package:tallee/data/dao/player_dao.dart';
|
||||
import 'package:tallee/data/dao/player_group_dao.dart';
|
||||
import 'package:tallee/data/dao/player_match_dao.dart';
|
||||
import 'package:tallee/data/db/tables/group_match_table.dart';
|
||||
import 'package:tallee/data/dao/score_dao.dart';
|
||||
import 'package:tallee/data/dao/team_dao.dart';
|
||||
import 'package:tallee/data/db/tables/game_table.dart';
|
||||
import 'package:tallee/data/db/tables/group_table.dart';
|
||||
import 'package:tallee/data/db/tables/match_table.dart';
|
||||
import 'package:tallee/data/db/tables/player_group_table.dart';
|
||||
import 'package:tallee/data/db/tables/player_match_table.dart';
|
||||
import 'package:tallee/data/db/tables/player_table.dart';
|
||||
import 'package:tallee/data/db/tables/score_table.dart';
|
||||
import 'package:tallee/data/db/tables/team_table.dart';
|
||||
|
||||
part 'database.g.dart';
|
||||
|
||||
@@ -23,7 +27,9 @@ part 'database.g.dart';
|
||||
MatchTable,
|
||||
PlayerGroupTable,
|
||||
PlayerMatchTable,
|
||||
GroupMatchTable,
|
||||
GameTable,
|
||||
TeamTable,
|
||||
ScoreTable,
|
||||
],
|
||||
daos: [
|
||||
PlayerDao,
|
||||
@@ -31,7 +37,9 @@ part 'database.g.dart';
|
||||
MatchDao,
|
||||
PlayerGroupDao,
|
||||
PlayerMatchDao,
|
||||
GroupMatchDao,
|
||||
GameDao,
|
||||
ScoreDao,
|
||||
TeamDao
|
||||
],
|
||||
)
|
||||
class AppDatabase extends _$AppDatabase {
|
||||
@@ -52,9 +60,7 @@ class AppDatabase extends _$AppDatabase {
|
||||
static QueryExecutor _openConnection() {
|
||||
return driftDatabase(
|
||||
name: 'gametracker_db',
|
||||
native: const DriftNativeOptions(
|
||||
databaseDirectory: getApplicationSupportDirectory,
|
||||
),
|
||||
native: const DriftNativeOptions(databaseDirectory: getApplicationSupportDirectory),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/tables/game_table.dart';
|
||||
import 'package:game_tracker/data/db/tables/group_table.dart';
|
||||
import 'package:tallee/data/db/tables/game_table.dart';
|
||||
import 'package:tallee/data/db/tables/group_table.dart';
|
||||
|
||||
class MatchTable extends Table {
|
||||
TextColumn get id => text()();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:tallee/data/db/tables/match_table.dart';
|
||||
import 'package:tallee/data/db/tables/player_table.dart';
|
||||
import 'package:tallee/data/db/tables/team_table.dart';
|
||||
|
||||
class PlayerMatchTable extends Table {
|
||||
TextColumn get playerId =>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/tables/match_table.dart';
|
||||
import 'package:game_tracker/data/db/tables/player_table.dart';
|
||||
import 'package:tallee/data/db/tables/match_table.dart';
|
||||
import 'package:tallee/data/db/tables/player_table.dart';
|
||||
|
||||
class ScoreTable extends Table {
|
||||
TextColumn get playerId =>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:clock/clock.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'package:game_tracker/core/enums.dart';
|
||||
import 'package:tallee/core/enums.dart';
|
||||
|
||||
class Game {
|
||||
final String id;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:clock/clock.dart';
|
||||
import 'package:tallee/core/enums.dart';
|
||||
import 'package:tallee/data/dto/game.dart';
|
||||
import 'package:tallee/data/dto/group.dart';
|
||||
import 'package:tallee/data/dto/player.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:clock/clock.dart';
|
||||
import 'package:game_tracker/data/dto/player.dart';
|
||||
import 'package:tallee/data/dto/player.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class Team {
|
||||
|
||||
Reference in New Issue
Block a user