✨ Dashboard explore
This commit is contained in:
59
lib/models/author.dart
Executable file
59
lib/models/author.dart
Executable file
@ -0,0 +1,59 @@
|
||||
class Author {
|
||||
int id;
|
||||
DateTime createdAt;
|
||||
DateTime updatedAt;
|
||||
DateTime? deletedAt;
|
||||
String name;
|
||||
String nick;
|
||||
String avatar;
|
||||
String banner;
|
||||
String description;
|
||||
String emailAddress;
|
||||
int powerLevel;
|
||||
int externalId;
|
||||
|
||||
Author({
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
required this.name,
|
||||
required this.nick,
|
||||
required this.avatar,
|
||||
required this.banner,
|
||||
required this.description,
|
||||
required this.emailAddress,
|
||||
required this.powerLevel,
|
||||
required this.externalId,
|
||||
});
|
||||
|
||||
factory Author.fromJson(Map<String, dynamic> json) => Author(
|
||||
id: json["id"],
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: DateTime.parse(json["updated_at"]),
|
||||
deletedAt: json["deleted_at"],
|
||||
name: json["name"],
|
||||
nick: json["nick"],
|
||||
avatar: json["avatar"],
|
||||
banner: json["banner"],
|
||||
description: json["description"],
|
||||
emailAddress: json["email_address"],
|
||||
powerLevel: json["power_level"],
|
||||
externalId: json["external_id"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"updated_at": updatedAt.toIso8601String(),
|
||||
"deleted_at": deletedAt,
|
||||
"name": name,
|
||||
"nick": nick,
|
||||
"avatar": avatar,
|
||||
"banner": banner,
|
||||
"description": description,
|
||||
"email_address": emailAddress,
|
||||
"power_level": powerLevel,
|
||||
"external_id": externalId,
|
||||
};
|
||||
}
|
79
lib/models/notification.dart
Executable file
79
lib/models/notification.dart
Executable file
@ -0,0 +1,79 @@
|
||||
class Notification {
|
||||
int id;
|
||||
DateTime createdAt;
|
||||
DateTime updatedAt;
|
||||
DateTime? deletedAt;
|
||||
String subject;
|
||||
String content;
|
||||
List<Link>? links;
|
||||
bool isImportant;
|
||||
DateTime? readAt;
|
||||
int senderId;
|
||||
int recipientId;
|
||||
|
||||
Notification({
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
required this.subject,
|
||||
required this.content,
|
||||
this.links,
|
||||
required this.isImportant,
|
||||
this.readAt,
|
||||
required this.senderId,
|
||||
required this.recipientId,
|
||||
});
|
||||
|
||||
factory Notification.fromJson(Map<String, dynamic> json) => Notification(
|
||||
id: json["id"],
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: DateTime.parse(json["updated_at"]),
|
||||
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(),
|
||||
isImportant: json["is_important"],
|
||||
readAt: json["read_at"],
|
||||
senderId: json["sender_id"],
|
||||
recipientId: json["recipient_id"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"updated_at": updatedAt.toIso8601String(),
|
||||
"deleted_at": deletedAt,
|
||||
"subject": subject,
|
||||
"content": content,
|
||||
"links": links != null
|
||||
? List<dynamic>.from(links!.map((x) => x.toJson()))
|
||||
: List.empty(),
|
||||
"is_important": isImportant,
|
||||
"read_at": readAt,
|
||||
"sender_id": senderId,
|
||||
"recipient_id": recipientId,
|
||||
};
|
||||
}
|
||||
|
||||
class Link {
|
||||
String label;
|
||||
String url;
|
||||
|
||||
Link({
|
||||
required this.label,
|
||||
required this.url,
|
||||
});
|
||||
|
||||
factory Link.fromJson(Map<String, dynamic> json) => Link(
|
||||
label: json["label"],
|
||||
url: json["url"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"label": label,
|
||||
"url": url,
|
||||
};
|
||||
}
|
17
lib/models/pagination.dart
Executable file
17
lib/models/pagination.dart
Executable file
@ -0,0 +1,17 @@
|
||||
class PaginationResult {
|
||||
int count;
|
||||
List<dynamic>? data;
|
||||
|
||||
PaginationResult({
|
||||
required this.count,
|
||||
this.data,
|
||||
});
|
||||
|
||||
factory PaginationResult.fromJson(Map<String, dynamic> json) =>
|
||||
PaginationResult(count: json["count"], data: json["data"]);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"count": count,
|
||||
"data": data,
|
||||
};
|
||||
}
|
154
lib/models/post.dart
Executable file
154
lib/models/post.dart
Executable file
@ -0,0 +1,154 @@
|
||||
import 'package:solian/models/author.dart';
|
||||
|
||||
class Post {
|
||||
int id;
|
||||
DateTime createdAt;
|
||||
DateTime updatedAt;
|
||||
DateTime? deletedAt;
|
||||
String alias;
|
||||
String title;
|
||||
String description;
|
||||
String content;
|
||||
String modelType;
|
||||
int commentCount;
|
||||
int reactionCount;
|
||||
int authorId;
|
||||
int? realmId;
|
||||
Author author;
|
||||
List<Attachment>? attachments;
|
||||
Map<String, dynamic>? reactionList;
|
||||
|
||||
Post({
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
required this.alias,
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.content,
|
||||
required this.modelType,
|
||||
required this.commentCount,
|
||||
required this.reactionCount,
|
||||
required this.authorId,
|
||||
this.realmId,
|
||||
required this.author,
|
||||
this.attachments,
|
||||
this.reactionList,
|
||||
});
|
||||
|
||||
factory Post.fromJson(Map<String, dynamic> json) => Post(
|
||||
id: json["id"],
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: DateTime.parse(json["updated_at"]),
|
||||
deletedAt: json["deleted_at"],
|
||||
alias: json["alias"],
|
||||
title: json["title"],
|
||||
description: json["description"],
|
||||
content: json["content"],
|
||||
modelType: json["model_type"],
|
||||
commentCount: json["comment_count"],
|
||||
reactionCount: json["reaction_count"],
|
||||
authorId: json["author_id"],
|
||||
realmId: json["realm_id"],
|
||||
author: Author.fromJson(json["author"]),
|
||||
attachments: json["attachments"] != null
|
||||
? List<Attachment>.from(
|
||||
json["attachments"].map((x) => Attachment.fromJson(x)))
|
||||
: List.empty(),
|
||||
reactionList: json["reaction_list"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"updated_at": updatedAt.toIso8601String(),
|
||||
"deleted_at": deletedAt,
|
||||
"alias": alias,
|
||||
"title": title,
|
||||
"description": description,
|
||||
"content": content,
|
||||
"model_type": modelType,
|
||||
"comment_count": commentCount,
|
||||
"reaction_count": reactionCount,
|
||||
"author_id": authorId,
|
||||
"realm_id": realmId,
|
||||
"author": author.toJson(),
|
||||
"attachments": attachments == null
|
||||
? List.empty()
|
||||
: List<dynamic>.from(attachments!.map((x) => x.toJson())),
|
||||
"reaction_list": reactionList,
|
||||
};
|
||||
}
|
||||
|
||||
class Attachment {
|
||||
int id;
|
||||
DateTime createdAt;
|
||||
DateTime updatedAt;
|
||||
DateTime? deletedAt;
|
||||
String fileId;
|
||||
int filesize;
|
||||
String filename;
|
||||
String mimetype;
|
||||
int type;
|
||||
String externalUrl;
|
||||
Author author;
|
||||
int? articleId;
|
||||
int? momentId;
|
||||
int? commentId;
|
||||
int? authorId;
|
||||
|
||||
Attachment({
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
required this.fileId,
|
||||
required this.filesize,
|
||||
required this.filename,
|
||||
required this.mimetype,
|
||||
required this.type,
|
||||
required this.externalUrl,
|
||||
required this.author,
|
||||
this.articleId,
|
||||
this.momentId,
|
||||
this.commentId,
|
||||
this.authorId,
|
||||
});
|
||||
|
||||
factory Attachment.fromJson(Map<String, dynamic> json) => Attachment(
|
||||
id: json["id"],
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: DateTime.parse(json["updated_at"]),
|
||||
deletedAt: json["deleted_at"],
|
||||
fileId: json["file_id"],
|
||||
filesize: json["filesize"],
|
||||
filename: json["filename"],
|
||||
mimetype: json["mimetype"],
|
||||
type: json["type"],
|
||||
externalUrl: json["external_url"],
|
||||
author: Author.fromJson(json["author"]),
|
||||
articleId: json["article_id"],
|
||||
momentId: json["moment_id"],
|
||||
commentId: json["comment_id"],
|
||||
authorId: json["author_id"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"updated_at": updatedAt.toIso8601String(),
|
||||
"deleted_at": deletedAt,
|
||||
"file_id": fileId,
|
||||
"filesize": filesize,
|
||||
"filename": filename,
|
||||
"mimetype": mimetype,
|
||||
"type": type,
|
||||
"external_url": externalUrl,
|
||||
"author": author.toJson(),
|
||||
"article_id": articleId,
|
||||
"moment_id": momentId,
|
||||
"comment_id": commentId,
|
||||
"author_id": authorId,
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user