Added createdAt attribute in dto classes and json schema
This commit is contained in:
@@ -4,9 +4,9 @@ import 'package:uuid/uuid.dart';
|
||||
|
||||
class Group {
|
||||
final String id;
|
||||
final DateTime createdAt;
|
||||
final String name;
|
||||
final List<Player> members;
|
||||
final DateTime createdAt;
|
||||
|
||||
Group({
|
||||
String? id,
|
||||
@@ -24,6 +24,7 @@ class Group {
|
||||
/// Creates a Group instance from a JSON object.
|
||||
Group.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
createdAt = DateTime.parse(json['createdAt']),
|
||||
name = json['name'],
|
||||
members = (json['members'] as List)
|
||||
.map((memberJson) => Player.fromJson(memberJson))
|
||||
@@ -32,6 +33,7 @@ class Group {
|
||||
/// Converts the Group instance to a JSON object.
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'createdAt': createdAt.toIso8601String(),
|
||||
'name': name,
|
||||
'members': members.map((member) => member.toJson()).toList(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user