added createdAt timestamp to Group, Game, and Player DTOs
This commit is contained in:
@@ -8,14 +8,17 @@ class Game {
|
||||
final List<Player>? players;
|
||||
final Group? group;
|
||||
final String winner;
|
||||
final DateTime createdAt;
|
||||
|
||||
Game({
|
||||
String? id,
|
||||
DateTime? createdAt,
|
||||
required this.name,
|
||||
this.players,
|
||||
this.group,
|
||||
this.winner = '',
|
||||
}) : id = id ?? const Uuid().v4();
|
||||
}) : id = id ?? const Uuid().v4(),
|
||||
createdAt = createdAt ?? DateTime.now();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
||||
@@ -5,9 +5,15 @@ class Group {
|
||||
final String id;
|
||||
final String name;
|
||||
final List<Player> members;
|
||||
final DateTime createdAt;
|
||||
|
||||
Group({String? id, required this.name, required this.members})
|
||||
: id = id ?? const Uuid().v4();
|
||||
Group({
|
||||
String? id,
|
||||
DateTime? createdAt,
|
||||
required this.name,
|
||||
required this.members,
|
||||
}) : id = id ?? const Uuid().v4(),
|
||||
createdAt = createdAt ?? DateTime.now();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
||||
@@ -3,8 +3,11 @@ import 'package:uuid/uuid.dart';
|
||||
class Player {
|
||||
final String id;
|
||||
final String name;
|
||||
final DateTime createdAt;
|
||||
|
||||
Player({String? id, required this.name}) : id = id ?? const Uuid().v4();
|
||||
Player({String? id, DateTime? createdAt, required this.name})
|
||||
: id = id ?? const Uuid().v4(),
|
||||
createdAt = createdAt ?? DateTime.now();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
||||
Reference in New Issue
Block a user