add deleted attribute
This commit is contained in:
@@ -16,6 +16,7 @@ class Match {
|
||||
final List<Player> players;
|
||||
final String notes;
|
||||
Map<String, ScoreEntry?> scores;
|
||||
final bool deleted;
|
||||
|
||||
Match({
|
||||
required this.name,
|
||||
@@ -27,6 +28,7 @@ class Match {
|
||||
String? id,
|
||||
DateTime? createdAt,
|
||||
Map<String, ScoreEntry?>? scores,
|
||||
this.deleted = false,
|
||||
}) : id = id ?? const Uuid().v4(),
|
||||
createdAt = createdAt ?? clock.now(),
|
||||
scores = scores ?? {for (Player p in players) p.id: null};
|
||||
@@ -65,7 +67,8 @@ class Match {
|
||||
),
|
||||
)
|
||||
: {},
|
||||
notes = json['notes'] ?? '';
|
||||
notes = json['notes'] ?? '',
|
||||
deleted = json['deleted'] ?? false;
|
||||
|
||||
/// Converts the Match instance to a JSON object. Related objects are
|
||||
/// represented by their IDs, so the game, group, and players are not fully
|
||||
@@ -80,6 +83,7 @@ class Match {
|
||||
'playerIds': players.map((player) => player.id).toList(),
|
||||
'scores': scores.map((key, value) => MapEntry(key, value?.toJson())),
|
||||
'notes': notes,
|
||||
'deleted': deleted,
|
||||
};
|
||||
|
||||
List<Player> get mvp {
|
||||
|
||||
Reference in New Issue
Block a user