chore: cast data as String in ActivityRoleModel.fromJson to throw error on null userID (#3701)

This commit is contained in:
ggurdin 2025-08-12 13:51:44 -04:00 committed by GitHub
parent d82efa2ced
commit cbc201c0e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,14 +19,14 @@ class ActivityRoleModel {
factory ActivityRoleModel.fromJson(Map<String, dynamic> json) {
return ActivityRoleModel(
id: json['id'],
userId: json['userId'],
role: json['role'],
finishedAt: json['finishedAt'] != null
? DateTime.parse(json['finishedAt'])
id: json['id'] as String,
userId: json['user_id'] as String,
role: json['role'] as String?,
finishedAt: json['finished_at'] != null
? DateTime.parse(json['finished_at'])
: null,
archivedAt: json['archivedAt'] != null
? DateTime.parse(json['archivedAt'])
archivedAt: json['archived_at'] != null
? DateTime.parse(json['archived_at'])
: null,
);
}
@ -34,10 +34,10 @@ class ActivityRoleModel {
Map<String, dynamic> toJson() {
return {
'id': id,
'userId': userId,
'user_id': userId,
'role': role,
'finishedAt': finishedAt?.toIso8601String(),
'archivedAt': archivedAt?.toIso8601String(),
'finished_at': finishedAt?.toIso8601String(),
'archived_at': archivedAt?.toIso8601String(),
};
}