chore: cast data as String in ActivityRoleModel.fromJson to throw error on null userID (#3701)
This commit is contained in:
parent
d82efa2ced
commit
cbc201c0e0
1 changed files with 10 additions and 10 deletions
|
|
@ -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(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue