D1APP-48 data model updates
This commit is contained in:
parent
7f1af1422c
commit
ca88dd1caf
|
|
@ -0,0 +1,54 @@
|
||||||
|
import 'package:didvan/models/content.dart';
|
||||||
|
import 'package:didvan/models/tag.dart';
|
||||||
|
|
||||||
|
class NewsDetailsData {
|
||||||
|
final int id;
|
||||||
|
final String title;
|
||||||
|
final String reference;
|
||||||
|
final String image;
|
||||||
|
final String createdAt;
|
||||||
|
final bool marked;
|
||||||
|
final int comments;
|
||||||
|
final List<Tag> tags;
|
||||||
|
final List<Content> contents;
|
||||||
|
|
||||||
|
const NewsDetailsData({
|
||||||
|
required this.id,
|
||||||
|
required this.title,
|
||||||
|
required this.reference,
|
||||||
|
required this.image,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.marked,
|
||||||
|
required this.comments,
|
||||||
|
required this.tags,
|
||||||
|
required this.contents,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory NewsDetailsData.fromJson(Map<String, dynamic> json) {
|
||||||
|
return NewsDetailsData(
|
||||||
|
id: json['id'],
|
||||||
|
title: json['title'],
|
||||||
|
reference: json['reference'],
|
||||||
|
image: json['image'],
|
||||||
|
createdAt: json['createdAt'],
|
||||||
|
marked: json['marked'],
|
||||||
|
comments: json['comments'],
|
||||||
|
tags: List<Tag>.from(json['tags'].map((tag) => Tag.fromJson(tag))),
|
||||||
|
contents: List<Content>.from(json['contents'].map(
|
||||||
|
(content) => Content.fromJson(content),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
'id': id,
|
||||||
|
'title': title,
|
||||||
|
'reference': reference,
|
||||||
|
'image': image,
|
||||||
|
'createdAt': createdAt,
|
||||||
|
'marked': marked,
|
||||||
|
'comments': comments,
|
||||||
|
'tags': tags.map((e) => e.toJson()).toList(),
|
||||||
|
'contents': contents.map((e) => e.toJson()).toList(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -7,7 +7,6 @@ class RadarDetailsData {
|
||||||
final int id;
|
final int id;
|
||||||
final String title;
|
final String title;
|
||||||
final String image;
|
final String image;
|
||||||
final String description;
|
|
||||||
final int timeToRead;
|
final int timeToRead;
|
||||||
final String createdAt;
|
final String createdAt;
|
||||||
final String? podcast;
|
final String? podcast;
|
||||||
|
|
@ -22,7 +21,6 @@ class RadarDetailsData {
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.title,
|
required this.title,
|
||||||
required this.image,
|
required this.image,
|
||||||
required this.description,
|
|
||||||
required this.timeToRead,
|
required this.timeToRead,
|
||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
required this.podcast,
|
required this.podcast,
|
||||||
|
|
@ -39,7 +37,6 @@ class RadarDetailsData {
|
||||||
id: json['id'],
|
id: json['id'],
|
||||||
title: json['title'],
|
title: json['title'],
|
||||||
image: json['image'],
|
image: json['image'],
|
||||||
description: json['description'],
|
|
||||||
timeToRead: json['timeToRead'],
|
timeToRead: json['timeToRead'],
|
||||||
createdAt: json['createdAt'],
|
createdAt: json['createdAt'],
|
||||||
podcast: json['podcast'],
|
podcast: json['podcast'],
|
||||||
|
|
@ -64,7 +61,6 @@ class RadarDetailsData {
|
||||||
'id': id,
|
'id': id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'image': image,
|
'image': image,
|
||||||
'description': description,
|
|
||||||
'timeToRead': timeToRead,
|
'timeToRead': timeToRead,
|
||||||
'createdAt': createdAt,
|
'createdAt': createdAt,
|
||||||
'podcast': podcast,
|
'podcast': podcast,
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import '../category.dart';
|
import 'category.dart';
|
||||||
|
|
||||||
class RadarOverview {
|
class RadarOverview {
|
||||||
final int id;
|
final int id;
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
class SettingsData {
|
|
||||||
final String brightness;
|
|
||||||
final List<String> notificationTimeRange;
|
|
||||||
final String fontFamily;
|
|
||||||
final double fontSizeScale;
|
|
||||||
|
|
||||||
SettingsData(
|
|
||||||
this.brightness,
|
|
||||||
this.notificationTimeRange,
|
|
||||||
this.fontFamily,
|
|
||||||
this.fontSizeScale,
|
|
||||||
);
|
|
||||||
|
|
||||||
factory SettingsData.fromJson(Map json) => SettingsData(
|
|
||||||
json['brightness'],
|
|
||||||
json['notificationTimeRange'],
|
|
||||||
json['fontFamily'],
|
|
||||||
json['fontSizeScale'],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map toJson() => {
|
|
||||||
'brightness': brightness,
|
|
||||||
'notificationTimeRange': notificationTimeRange,
|
|
||||||
'fontFamily': fontFamily,
|
|
||||||
'fontSizeScale': fontSizeScale,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import 'package:didvan/services/network/request_helper.dart';
|
|
||||||
|
|
||||||
class User {
|
class User {
|
||||||
final int id;
|
final int id;
|
||||||
final String phoneNumber;
|
final String phoneNumber;
|
||||||
|
|
@ -21,7 +19,7 @@ class User {
|
||||||
id: json['id'],
|
id: json['id'],
|
||||||
username: json['username'],
|
username: json['username'],
|
||||||
phoneNumber: json['phoneNumber'],
|
phoneNumber: json['phoneNumber'],
|
||||||
photo: RequestHelper.baseUrl + json['photo'],
|
photo: json['photo'],
|
||||||
fullName: json['fullName'],
|
fullName: json['fullName'],
|
||||||
email: json['email'],
|
email: json['email'],
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue