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'; import 'user.dart';
class CommentData { class CommentData {
final int id; int id;
final String text; final String text;
final String createdAt; final String createdAt;
final bool liked; final bool liked;

View File

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

View File

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

View File

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

View File

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