From c43b7b478ce3d552c072860241edc6f7e351ba73 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Mon, 13 Apr 2026 22:47:29 +0200 Subject: [PATCH] Updated comments --- lib/data/models/group.dart | 9 +++++---- lib/data/models/match.dart | 15 +++++++++------ lib/data/models/team.dart | 3 ++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/data/models/group.dart b/lib/data/models/group.dart index aa3961c..c684541 100644 --- a/lib/data/models/group.dart +++ b/lib/data/models/group.dart @@ -24,16 +24,17 @@ class Group { return 'Group{id: $id, name: $name, description: $description, members: $members}'; } - /// Creates a Group instance from a JSON object (memberIds format). - /// Player objects are reconstructed from memberIds by the DataTransferService. + /// Creates a Group instance from a JSON object where the related [Player] + /// objects are represented by their IDs. Group.fromJson(Map json) : id = json['id'], createdAt = DateTime.parse(json['createdAt']), name = json['name'], description = json['description'], - members = []; // Populated during import via DataTransferService + members = []; - /// Converts the Group instance to a JSON object using normalized format (memberIds only). + /// Converts the Group instance to a JSON object. Related [Player] objects are + /// represented by their IDs. Map toJson() => { 'id': id, 'createdAt': createdAt.toIso8601String(), diff --git a/lib/data/models/match.dart b/lib/data/models/match.dart index a6d91c7..60103de 100644 --- a/lib/data/models/match.dart +++ b/lib/data/models/match.dart @@ -38,8 +38,9 @@ class Match { return 'Match{id: $id, createdAt: $createdAt, endedAt: $endedAt, name: $name, game: $game, group: $group, players: $players, notes: $notes, scores: $scores, winner: $winner}'; } - /// Creates a Match instance from a JSON object (ID references format). - /// Related objects are reconstructed from IDs by the DataTransferService. + /// Creates a Match instance from a JSON object where related objects are + /// represented by their IDs. Therefore, the game, group, and players are not + /// fully constructed here. Match.fromJson(Map json) : id = json['id'], createdAt = DateTime.parse(json['createdAt']), @@ -53,13 +54,15 @@ class Match { description: '', color: GameColor.blue, icon: '', - ), // Populated during import via DataTransferService - group = null, // Populated during import via DataTransferService - players = [], // Populated during import via DataTransferService + ), + group = null, + players = [], scores = json['scores'], notes = json['notes'] ?? ''; - /// Converts the Match instance to a JSON object using normalized format (ID references only). + /// Converts the Match instance to a JSON object. Related objects are + /// represented by their IDs, so the game, group, and players are not fully + /// serialized here. Map toJson() => { 'id': id, 'createdAt': createdAt.toIso8601String(), diff --git a/lib/data/models/team.dart b/lib/data/models/team.dart index 8c16280..f5941c4 100644 --- a/lib/data/models/team.dart +++ b/lib/data/models/team.dart @@ -29,7 +29,8 @@ class Team { createdAt = DateTime.parse(json['createdAt']), members = []; // Populated during import via DataTransferService - /// Converts the Team instance to a JSON object using normalized format (memberIds only). + /// Converts the Team instance to a JSON object. Related objects are + /// represented by their IDs. Map toJson() => { 'id': id, 'name': name,