D1APP-48 model updates
This commit is contained in:
parent
2e1365d03b
commit
33dabd7ab5
|
|
@ -2,17 +2,17 @@ import 'feedback.dart';
|
|||
import 'reply.dart';
|
||||
import 'user.dart';
|
||||
|
||||
class Comment {
|
||||
class CommentData {
|
||||
final int id;
|
||||
final String text;
|
||||
final String createdAt;
|
||||
final bool liked;
|
||||
final bool disliked;
|
||||
final Feedback feedback;
|
||||
final User user;
|
||||
FeedbackData feedback;
|
||||
final UserOverview user;
|
||||
final List<Reply> replies;
|
||||
|
||||
Comment({
|
||||
CommentData({
|
||||
required this.id,
|
||||
required this.text,
|
||||
required this.createdAt,
|
||||
|
|
@ -23,14 +23,14 @@ class Comment {
|
|||
required this.replies,
|
||||
});
|
||||
|
||||
factory Comment.fromJson(Map<String, dynamic> json) => Comment(
|
||||
factory CommentData.fromJson(Map<String, dynamic> json) => CommentData(
|
||||
id: json['id'],
|
||||
text: json['text'],
|
||||
createdAt: json['createdAt'],
|
||||
liked: json['liked'],
|
||||
disliked: json['disliked'],
|
||||
feedback: Feedback.fromJson(json['feedback']),
|
||||
user: User.fromJson(json['user']),
|
||||
feedback: FeedbackData.fromJson(json['feedback']),
|
||||
user: UserOverview.fromJson(json['user']),
|
||||
replies: List<Reply>.from(
|
||||
json['replies'].map(
|
||||
(reply) => Reply.fromJson(reply),
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
class Feedback {
|
||||
class FeedbackData {
|
||||
final int like;
|
||||
final int dislike;
|
||||
|
||||
const Feedback({required this.like, required this.dislike});
|
||||
const FeedbackData({required this.like, required this.dislike});
|
||||
|
||||
factory Feedback.fromJson(Map<String, dynamic> json) => Feedback(
|
||||
factory FeedbackData.fromJson(Map<String, dynamic> json) => FeedbackData(
|
||||
like: json['like'],
|
||||
dislike: json['dislike'],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ class Reply {
|
|||
final String createdAt;
|
||||
final bool liked;
|
||||
final bool disliked;
|
||||
final Feedback feedback;
|
||||
final User user;
|
||||
final FeedbackData feedback;
|
||||
final UserOverview user;
|
||||
final UserOverview toUser;
|
||||
|
||||
const Reply({
|
||||
required this.id,
|
||||
|
|
@ -18,6 +19,7 @@ class Reply {
|
|||
required this.disliked,
|
||||
required this.feedback,
|
||||
required this.user,
|
||||
required this.toUser,
|
||||
});
|
||||
|
||||
factory Reply.fromJson(Map<String, dynamic> json) => Reply(
|
||||
|
|
@ -26,8 +28,9 @@ class Reply {
|
|||
createdAt: json['createdAt'],
|
||||
liked: json['liked'],
|
||||
disliked: json['disliked'],
|
||||
feedback: Feedback.fromJson(json['feedback']),
|
||||
user: User.fromJson(json['user']),
|
||||
feedback: FeedbackData.fromJson(json['feedback']),
|
||||
user: UserOverview.fromJson(json['user']),
|
||||
toUser: UserOverview.fromJson(json['toUser']),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
|
|
@ -38,5 +41,6 @@ class Reply {
|
|||
'disliked': disliked,
|
||||
'feedback': feedback.toJson(),
|
||||
'user': user.toJson(),
|
||||
'toUser': toUser.toJson(),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
class User {
|
||||
class UserOverview {
|
||||
final int id;
|
||||
final String fullName;
|
||||
final String? photo;
|
||||
|
||||
const User({required this.id, required this.fullName, required this.photo});
|
||||
const UserOverview(
|
||||
{required this.id, required this.fullName, required this.photo});
|
||||
|
||||
factory User.fromJson(Map<String, dynamic> json) => User(
|
||||
factory UserOverview.fromJson(Map<String, dynamic> json) => UserOverview(
|
||||
id: json['id'],
|
||||
fullName: json['fullName'],
|
||||
photo: json['photo'],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
import 'package:didvan/models/category.dart';
|
||||
|
||||
class ItemOverview {
|
||||
final int id;
|
||||
final String title;
|
||||
final String image;
|
||||
final String description;
|
||||
final int timeToRead;
|
||||
final String reference;
|
||||
final bool forManagers;
|
||||
final String createdAt;
|
||||
final String type;
|
||||
final List<Category> categories;
|
||||
|
||||
const ItemOverview({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.image,
|
||||
required this.description,
|
||||
required this.timeToRead,
|
||||
required this.reference,
|
||||
required this.forManagers,
|
||||
required this.createdAt,
|
||||
required this.type,
|
||||
required this.categories,
|
||||
});
|
||||
|
||||
factory ItemOverview.fromJson(Map<String, dynamic> json) => ItemOverview(
|
||||
id: json['id'],
|
||||
title: json['title'],
|
||||
image: json['image'],
|
||||
description: json['description'],
|
||||
timeToRead: json['timeToRead'],
|
||||
reference: json['reference'],
|
||||
forManagers: json['forManagers'],
|
||||
createdAt: json['createdAt'],
|
||||
type: json['type'],
|
||||
categories: List<Category>.from(
|
||||
json['categories'].map(
|
||||
(cat) => Category.fromJson(cat),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'title': title,
|
||||
'image': image,
|
||||
'description': description,
|
||||
'timeToRead': timeToRead,
|
||||
'reference': reference,
|
||||
'forManagers': forManagers,
|
||||
'createdAt': createdAt,
|
||||
'type': type,
|
||||
'categories': categories.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
class NewsRequestArgs {
|
||||
final int page;
|
||||
final String? startDate;
|
||||
final String? endDate;
|
||||
final String? search;
|
||||
|
||||
const NewsRequestArgs({
|
||||
required this.page,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.search,
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
class RadarRequestArgs {
|
||||
final int page;
|
||||
final List<int> categories;
|
||||
final String? startDate;
|
||||
final String? endDate;
|
||||
final String? search;
|
||||
|
||||
const RadarRequestArgs({
|
||||
required this.page,
|
||||
this.categories = const [],
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.search,
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue