2024-05-18 10:17:16 +00:00
|
|
|
class Notification {
|
|
|
|
int id;
|
|
|
|
DateTime createdAt;
|
|
|
|
DateTime updatedAt;
|
|
|
|
DateTime? deletedAt;
|
2024-07-19 15:38:25 +00:00
|
|
|
String title;
|
|
|
|
String? subtitle;
|
|
|
|
String body;
|
|
|
|
String? avatar;
|
|
|
|
String? picture;
|
2024-05-18 10:17:16 +00:00
|
|
|
int? senderId;
|
2024-07-21 15:43:18 +00:00
|
|
|
int accountId;
|
2024-05-18 10:17:16 +00:00
|
|
|
|
|
|
|
Notification({
|
|
|
|
required this.id,
|
|
|
|
required this.createdAt,
|
|
|
|
required this.updatedAt,
|
2024-05-28 16:14:41 +00:00
|
|
|
required this.deletedAt,
|
2024-07-19 15:38:25 +00:00
|
|
|
required this.title,
|
|
|
|
required this.subtitle,
|
|
|
|
required this.body,
|
|
|
|
required this.avatar,
|
|
|
|
required this.picture,
|
2024-05-28 16:14:41 +00:00
|
|
|
required this.senderId,
|
2024-07-21 15:43:18 +00:00
|
|
|
required this.accountId,
|
2024-05-18 10:17:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
factory Notification.fromJson(Map<String, dynamic> json) => Notification(
|
|
|
|
id: json['id'] ?? 0,
|
2024-05-28 16:14:41 +00:00
|
|
|
createdAt: json['created_at'] == null
|
|
|
|
? DateTime.now()
|
|
|
|
: DateTime.parse(json['created_at']),
|
|
|
|
updatedAt: json['updated_at'] == null
|
|
|
|
? DateTime.now()
|
|
|
|
: DateTime.parse(json['updated_at']),
|
2024-05-18 10:17:16 +00:00
|
|
|
deletedAt: json['deleted_at'],
|
2024-07-19 15:38:25 +00:00
|
|
|
title: json['title'],
|
|
|
|
subtitle: json['subtitle'],
|
|
|
|
body: json['body'],
|
|
|
|
avatar: json['avatar'],
|
|
|
|
picture: json['picture'],
|
2024-05-18 10:17:16 +00:00
|
|
|
senderId: json['sender_id'],
|
2024-07-21 15:43:18 +00:00
|
|
|
accountId: json['account_id'],
|
2024-05-18 10:17:16 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
'id': id,
|
|
|
|
'created_at': createdAt.toIso8601String(),
|
|
|
|
'updated_at': updatedAt.toIso8601String(),
|
|
|
|
'deleted_at': deletedAt,
|
2024-07-19 15:38:25 +00:00
|
|
|
'title': title,
|
|
|
|
'subtitle': subtitle,
|
|
|
|
'body': body,
|
|
|
|
'avatar': avatar,
|
|
|
|
'picture': picture,
|
2024-05-18 10:17:16 +00:00
|
|
|
'sender_id': senderId,
|
2024-07-21 15:43:18 +00:00
|
|
|
'account_id': accountId,
|
2024-05-18 10:17:16 +00:00
|
|
|
};
|
|
|
|
}
|