model updates

This commit is contained in:
MohammadTaha Basiri 2022-01-26 00:15:12 +03:30
parent bd8e9b08bb
commit 97d36abfdd
6 changed files with 25 additions and 18 deletions

View File

@ -3,7 +3,7 @@ import 'reply.dart';
import 'user.dart';
class CommentData {
final int id;
int id;
final String text;
final String createdAt;
final bool liked;

View File

@ -5,14 +5,15 @@ class ItemOverview {
final String title;
final String image;
final String description;
final int timeToRead;
final String reference;
final bool forManagers;
final int? timeToRead;
final String? reference;
final bool? forManagers;
final String createdAt;
final String type;
final List<Category> categories;
final String? type;
final List<Category>? categories;
int? comments;
const ItemOverview({
ItemOverview({
required this.id,
required this.title,
required this.image,
@ -23,6 +24,7 @@ class ItemOverview {
required this.createdAt,
required this.type,
required this.categories,
required this.comments,
});
factory ItemOverview.fromJson(Map<String, dynamic> json) => ItemOverview(
@ -35,11 +37,14 @@ class ItemOverview {
forManagers: json['forManagers'],
createdAt: json['createdAt'],
type: json['type'],
categories: List<Category>.from(
json['categories'].map(
(cat) => Category.fromJson(cat),
),
),
comments: json['comments'],
categories: json['categories'] == null
? null
: List<Category>.from(
json['categories'].map(
(cat) => Category.fromJson(cat),
),
),
);
Map<String, dynamic> toJson() => {
@ -52,6 +57,6 @@ class ItemOverview {
'forManagers': forManagers,
'createdAt': createdAt,
'type': type,
'categories': categories.map((e) => e.toJson()).toList(),
'categories': categories?.map((e) => e.toJson()).toList(),
};
}

View File

@ -8,12 +8,12 @@ class NewsDetailsData {
final String image;
final String createdAt;
final bool marked;
final int comments;
int comments;
final int order;
final List<Tag> tags;
final List<Content> contents;
const NewsDetailsData({
NewsDetailsData({
required this.id,
required this.title,
required this.reference,

View File

@ -12,13 +12,13 @@ class RadarDetailsData {
final String? podcast;
final bool forManagers;
final bool marked;
final int comments;
int comments;
final List<Tag> tags;
final List<Content> contents;
final List<Category> categories;
final int order;
const RadarDetailsData({
RadarDetailsData({
required this.id,
required this.title,
required this.image,

View File

@ -10,7 +10,7 @@ class RadarOverview {
final bool forManagers;
bool marked;
final List<Category> categories;
final int comments;
int comments;
RadarOverview({
required this.id,

View File

@ -4,6 +4,7 @@ class RadarRequestArgs {
final String? startDate;
final String? endDate;
final String? search;
final bool? isSingleItem;
const RadarRequestArgs({
required this.page,
@ -11,5 +12,6 @@ class RadarRequestArgs {
this.startDate,
this.endDate,
this.search,
this.isSingleItem,
});
}