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 String title;
|
||||
final String image;
|
||||
final String description;
|
||||
final int timeToRead;
|
||||
final String createdAt;
|
||||
final String? podcast;
|
||||
|
|
@ -22,7 +21,6 @@ class RadarDetailsData {
|
|||
required this.id,
|
||||
required this.title,
|
||||
required this.image,
|
||||
required this.description,
|
||||
required this.timeToRead,
|
||||
required this.createdAt,
|
||||
required this.podcast,
|
||||
|
|
@ -39,7 +37,6 @@ class RadarDetailsData {
|
|||
id: json['id'],
|
||||
title: json['title'],
|
||||
image: json['image'],
|
||||
description: json['description'],
|
||||
timeToRead: json['timeToRead'],
|
||||
createdAt: json['createdAt'],
|
||||
podcast: json['podcast'],
|
||||
|
|
@ -64,7 +61,6 @@ class RadarDetailsData {
|
|||
'id': id,
|
||||
'title': title,
|
||||
'image': image,
|
||||
'description': description,
|
||||
'timeToRead': timeToRead,
|
||||
'createdAt': createdAt,
|
||||
'podcast': podcast,
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import '../category.dart';
|
||||
import 'category.dart';
|
||||
|
||||
class RadarOverview {
|
||||
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 {
|
||||
final int id;
|
||||
final String phoneNumber;
|
||||
|
|
@ -21,7 +19,7 @@ class User {
|
|||
id: json['id'],
|
||||
username: json['username'],
|
||||
phoneNumber: json['phoneNumber'],
|
||||
photo: RequestHelper.baseUrl + json['photo'],
|
||||
photo: json['photo'],
|
||||
fullName: json['fullName'],
|
||||
email: json['email'],
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue