169 lines
4.2 KiB
Dart
169 lines
4.2 KiB
Dart
import 'package:ftc_mobile_app/models/profileData/user_data.dart';
|
|
|
|
class TrainingResponseData {
|
|
TrainingResponseData({
|
|
this.proposedTrainings,
|
|
this.count,
|
|
this.offset,
|
|
this.limit,
|
|
});
|
|
|
|
TrainingResponseData.fromJson(dynamic json) {
|
|
if (json['proposedTrainings'] != null) {
|
|
proposedTrainings = [];
|
|
json['proposedTrainings'].forEach((v) {
|
|
proposedTrainings?.add(TrainingUsers.fromJson(v));
|
|
});
|
|
}
|
|
count = json['count'];
|
|
offset = json['offset'];
|
|
limit = json['limit'];
|
|
}
|
|
|
|
List<TrainingUsers>? proposedTrainings;
|
|
int? count;
|
|
int? offset;
|
|
int? limit;
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final map = <String, dynamic>{};
|
|
if (proposedTrainings != null) {
|
|
map['proposedTrainings'] =
|
|
proposedTrainings?.map((v) => v.toJson()).toList();
|
|
}
|
|
map['count'] = count;
|
|
map['offset'] = offset;
|
|
map['limit'] = limit;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
class TrainingUsers {
|
|
TrainingUsers({
|
|
this.id,
|
|
this.user,
|
|
this.trainingId,
|
|
this.active,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
});
|
|
|
|
TrainingUsers.fromJson(dynamic json) {
|
|
id = json['_id'];
|
|
user = json['user'] != null ? UserData.fromJson(json['user']) : null;
|
|
trainingId = json['trainingId'] != null
|
|
? ProposedTrainings.fromJson(json['trainingId'])
|
|
: null;
|
|
active = json['active'];
|
|
createdAt = json['createdAt'];
|
|
updatedAt = json['updatedAt'];
|
|
}
|
|
|
|
String? id;
|
|
UserData? user;
|
|
ProposedTrainings? trainingId;
|
|
bool? active;
|
|
String? createdAt;
|
|
String? updatedAt;
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final map = <String, dynamic>{};
|
|
map['_id'] = id;
|
|
if (user != null) {
|
|
map['user'] = user?.toJson();
|
|
}
|
|
if (trainingId != null) {
|
|
map['trainingId'] = trainingId?.toJson();
|
|
}
|
|
map['active'] = active;
|
|
map['createdAt'] = createdAt;
|
|
map['updatedAt'] = updatedAt;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
class ProposedTrainings {
|
|
ProposedTrainings({
|
|
this.id,
|
|
this.prpsName,
|
|
this.prpsDescription,
|
|
this.prpsTrgType,
|
|
this.prpsTrgClass,
|
|
this.prpsTrgStatus,
|
|
this.prpsTrgStartDate,
|
|
this.prpsTrgEndDate,
|
|
this.prpsTrgRegisterationDate,
|
|
this.addedby,
|
|
this.active,
|
|
this.contentType,
|
|
this.content,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
// this.users,
|
|
});
|
|
|
|
ProposedTrainings.fromJson(dynamic json) {
|
|
id = json['_id'];
|
|
prpsName = json['prpsName'];
|
|
prpsDescription = json['prpsDescription'];
|
|
prpsTrgType = json['prpsTrgType'];
|
|
prpsTrgClass = json['prpsTrgClass'];
|
|
prpsTrgStatus = json['prpsTrgStatus'];
|
|
prpsTrgStartDate = json['prpsTrgStartDate'];
|
|
prpsTrgEndDate = json['prpsTrgEndDate'];
|
|
prpsTrgRegisterationDate = json['prpsTrgRegisterationDate'];
|
|
addedby = json['addedby'];
|
|
active = json['active'];
|
|
contentType = json['contentType'];
|
|
content = json['content'] != null ? json['content'].cast<String>() : [];
|
|
createdAt = json['createdAt'];
|
|
updatedAt = json['updatedAt'];
|
|
// if (json['users'] != null) {
|
|
// users = [];
|
|
// json['users'].forEach((v) {
|
|
// users?.add(TrainingUsers.fromJson(v));
|
|
// });
|
|
// }
|
|
}
|
|
|
|
String? id;
|
|
String? prpsName;
|
|
String? prpsDescription;
|
|
String? prpsTrgType;
|
|
String? prpsTrgClass;
|
|
String? prpsTrgStatus;
|
|
int? prpsTrgStartDate;
|
|
int? prpsTrgEndDate;
|
|
int? prpsTrgRegisterationDate;
|
|
dynamic addedby;
|
|
bool? active;
|
|
String? contentType;
|
|
List<String>? content;
|
|
String? createdAt;
|
|
String? updatedAt;
|
|
// List<TrainingUsers>? users;
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final map = <String, dynamic>{};
|
|
map['_id'] = id;
|
|
map['prpsName'] = prpsName;
|
|
map['prpsDescription'] = prpsDescription;
|
|
map['prpsTrgType'] = prpsTrgType;
|
|
map['prpsTrgClass'] = prpsTrgClass;
|
|
map['prpsTrgStatus'] = prpsTrgStatus;
|
|
map['prpsTrgStartDate'] = prpsTrgStartDate;
|
|
map['prpsTrgEndDate'] = prpsTrgEndDate;
|
|
map['prpsTrgRegisterationDate'] = prpsTrgRegisterationDate;
|
|
map['addedby'] = addedby;
|
|
map['active'] = active;
|
|
map['contentType'] = contentType;
|
|
map['content'] = content;
|
|
map['createdAt'] = createdAt;
|
|
map['updatedAt'] = updatedAt;
|
|
// if (users != null) {
|
|
// map['users'] = users?.map((v) => v.toJson()).toList();
|
|
// }
|
|
return map;
|
|
}
|
|
}
|