Solian/lib/models/personal_page.dart

50 lines
1.3 KiB
Dart
Raw Normal View History

2024-05-18 10:17:16 +00:00
class PersonalPage {
int id;
DateTime createdAt;
DateTime updatedAt;
DateTime? deletedAt;
String content;
String script;
String style;
Map<String, String>? links;
int accountId;
PersonalPage({
required this.id,
required this.createdAt,
required this.updatedAt,
2024-05-28 16:14:41 +00:00
required this.deletedAt,
2024-05-18 10:17:16 +00:00
required this.content,
required this.script,
required this.style,
2024-05-28 16:14:41 +00:00
required this.links,
2024-05-18 10:17:16 +00:00
required this.accountId,
});
factory PersonalPage.fromJson(Map<String, dynamic> json) => PersonalPage(
id: json['id'],
createdAt: DateTime.parse(json['created_at']),
updatedAt: DateTime.parse(json['updated_at']),
2024-05-28 16:14:41 +00:00
deletedAt: json['deleted_at'] != null
? DateTime.parse(json['deleted_at'])
: null,
2024-05-18 10:17:16 +00:00
content: json['content'],
script: json['script'],
style: json['style'],
links: json['links'],
accountId: json['account_id'],
);
Map<String, dynamic> toJson() => {
'id': id,
'created_at': createdAt.toIso8601String(),
'updated_at': updatedAt.toIso8601String(),
'deleted_at': deletedAt?.toIso8601String(),
'content': content,
'script': script,
'style': style,
'links': links,
'account_id': accountId,
};
}