✨ Realm basis
This commit is contained in:
@ -9,7 +9,7 @@ class Notification {
|
||||
bool isImportant;
|
||||
bool isRealtime;
|
||||
DateTime? readAt;
|
||||
int senderId;
|
||||
int? senderId;
|
||||
int recipientId;
|
||||
|
||||
Notification({
|
||||
@ -23,7 +23,7 @@ class Notification {
|
||||
required this.isImportant,
|
||||
required this.isRealtime,
|
||||
this.readAt,
|
||||
required this.senderId,
|
||||
this.senderId,
|
||||
required this.recipientId,
|
||||
});
|
||||
|
||||
@ -34,9 +34,7 @@ class Notification {
|
||||
deletedAt: json['deleted_at'],
|
||||
subject: json['subject'],
|
||||
content: json['content'],
|
||||
links: json['links'] != null
|
||||
? List<Link>.from(json['links'].map((x) => Link.fromJson(x)))
|
||||
: List.empty(),
|
||||
links: json['links'] != null ? List<Link>.from(json['links'].map((x) => Link.fromJson(x))) : List.empty(),
|
||||
isImportant: json['is_important'],
|
||||
isRealtime: json['is_realtime'],
|
||||
readAt: json['read_at'],
|
||||
@ -51,9 +49,7 @@ class Notification {
|
||||
'deleted_at': deletedAt,
|
||||
'subject': subject,
|
||||
'content': content,
|
||||
'links': links != null
|
||||
? List<dynamic>.from(links!.map((x) => x.toJson()))
|
||||
: List.empty(),
|
||||
'links': links != null ? List<dynamic>.from(links!.map((x) => x.toJson())) : List.empty(),
|
||||
'is_important': isImportant,
|
||||
'is_realtime': isRealtime,
|
||||
'read_at': readAt,
|
||||
|
55
lib/models/realm.dart
Normal file
55
lib/models/realm.dart
Normal file
@ -0,0 +1,55 @@
|
||||
class Realm {
|
||||
int id;
|
||||
DateTime createdAt;
|
||||
DateTime updatedAt;
|
||||
DateTime? deletedAt;
|
||||
String alias;
|
||||
String name;
|
||||
String description;
|
||||
dynamic members;
|
||||
bool isPublic;
|
||||
bool isCommunity;
|
||||
int accountId;
|
||||
|
||||
Realm({
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
required this.alias,
|
||||
required this.name,
|
||||
required this.description,
|
||||
required this.members,
|
||||
required this.isPublic,
|
||||
required this.isCommunity,
|
||||
required this.accountId,
|
||||
});
|
||||
|
||||
factory Realm.fromJson(Map<String, dynamic> json) => Realm(
|
||||
id: json['id'],
|
||||
createdAt: DateTime.parse(json['created_at']),
|
||||
updatedAt: DateTime.parse(json['updated_at']),
|
||||
deletedAt: json['deleted_at'] != null ? DateTime.parse(json['deleted_at']) : null,
|
||||
alias: json['alias'],
|
||||
name: json['name'],
|
||||
description: json['description'],
|
||||
members: json['members'],
|
||||
isPublic: json['is_public'],
|
||||
isCommunity: json['is_community'],
|
||||
accountId: json['account_id'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'created_at': createdAt.toIso8601String(),
|
||||
'updated_at': updatedAt.toIso8601String(),
|
||||
'deleted_at': deletedAt,
|
||||
'alias': alias,
|
||||
'name': name,
|
||||
'description': description,
|
||||
'members': members,
|
||||
'is_public': isPublic,
|
||||
'is_community': isCommunity,
|
||||
'account_id': accountId,
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user