Updated comments
This commit is contained in:
@@ -24,16 +24,17 @@ class Group {
|
|||||||
return 'Group{id: $id, name: $name, description: $description, members: $members}';
|
return 'Group{id: $id, name: $name, description: $description, members: $members}';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a Group instance from a JSON object (memberIds format).
|
/// Creates a Group instance from a JSON object where the related [Player]
|
||||||
/// Player objects are reconstructed from memberIds by the DataTransferService.
|
/// objects are represented by their IDs.
|
||||||
Group.fromJson(Map<String, dynamic> json)
|
Group.fromJson(Map<String, dynamic> json)
|
||||||
: id = json['id'],
|
: id = json['id'],
|
||||||
createdAt = DateTime.parse(json['createdAt']),
|
createdAt = DateTime.parse(json['createdAt']),
|
||||||
name = json['name'],
|
name = json['name'],
|
||||||
description = json['description'],
|
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<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'id': id,
|
'id': id,
|
||||||
'createdAt': createdAt.toIso8601String(),
|
'createdAt': createdAt.toIso8601String(),
|
||||||
|
|||||||
@@ -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}';
|
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).
|
/// Creates a Match instance from a JSON object where related objects are
|
||||||
/// Related objects are reconstructed from IDs by the DataTransferService.
|
/// represented by their IDs. Therefore, the game, group, and players are not
|
||||||
|
/// fully constructed here.
|
||||||
Match.fromJson(Map<String, dynamic> json)
|
Match.fromJson(Map<String, dynamic> json)
|
||||||
: id = json['id'],
|
: id = json['id'],
|
||||||
createdAt = DateTime.parse(json['createdAt']),
|
createdAt = DateTime.parse(json['createdAt']),
|
||||||
@@ -53,13 +54,15 @@ class Match {
|
|||||||
description: '',
|
description: '',
|
||||||
color: GameColor.blue,
|
color: GameColor.blue,
|
||||||
icon: '',
|
icon: '',
|
||||||
), // Populated during import via DataTransferService
|
),
|
||||||
group = null, // Populated during import via DataTransferService
|
group = null,
|
||||||
players = [], // Populated during import via DataTransferService
|
players = [],
|
||||||
scores = json['scores'],
|
scores = json['scores'],
|
||||||
notes = json['notes'] ?? '';
|
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<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'id': id,
|
'id': id,
|
||||||
'createdAt': createdAt.toIso8601String(),
|
'createdAt': createdAt.toIso8601String(),
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ class Team {
|
|||||||
createdAt = DateTime.parse(json['createdAt']),
|
createdAt = DateTime.parse(json['createdAt']),
|
||||||
members = []; // Populated during import via DataTransferService
|
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<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'id': id,
|
'id': id,
|
||||||
'name': name,
|
'name': name,
|
||||||
|
|||||||
Reference in New Issue
Block a user