75 lines
2.3 KiB
Dart
75 lines
2.3 KiB
Dart
// To parse this JSON data, do
|
|
//
|
|
// final workHistory = workHistoryFromJson(jsonString);
|
|
|
|
import 'dart:convert';
|
|
|
|
import '../utils/agency.dart';
|
|
import '../utils/category.dart';
|
|
import '../utils/industry_class.dart';
|
|
import '../utils/position.dart';
|
|
|
|
WorkHistory workHistoryFromJson(String str) => WorkHistory.fromJson(json.decode(str));
|
|
|
|
String workHistoryToJson(WorkHistory data) => json.encode(data.toJson());
|
|
|
|
class WorkHistory {
|
|
WorkHistory({
|
|
this.id,
|
|
this.agency,
|
|
this.sgStep,
|
|
this.toDate,
|
|
this.position,
|
|
this.fromDate,
|
|
// this.attachments,
|
|
this.salaryGrade,
|
|
this.monthlySalary,
|
|
this.appointmentStatus,
|
|
});
|
|
|
|
final int? id;
|
|
final Agency? agency;
|
|
final int? sgStep;
|
|
final DateTime? toDate;
|
|
final Position? position;
|
|
final DateTime? fromDate;
|
|
// final dynamic attachments;
|
|
final int? salaryGrade;
|
|
final double? monthlySalary;
|
|
final String? appointmentStatus;
|
|
|
|
factory WorkHistory.fromJson(Map<String, dynamic> json) => WorkHistory(
|
|
id: json["id"],
|
|
agency: json["agency"] == null ? null : Agency.fromJson(json["agency"]),
|
|
sgStep: json["sg_step"],
|
|
toDate: json["to_date"] == null ? null : DateTime.parse(json["to_date"]),
|
|
position: json["position"] == null ? null : Position.fromJson(json["position"]),
|
|
fromDate: json["from_date"] == null ? null : DateTime.parse(json["from_date"]),
|
|
// attachments: json["attachments"],
|
|
salaryGrade: json["salary_grade"],
|
|
monthlySalary: json["monthly_salary"],
|
|
appointmentStatus: json["appointment_status"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"agency": agency?.toJson(),
|
|
"sg_step": sgStep,
|
|
"to_date": "${toDate!.year.toString().padLeft(4, '0')}-${toDate!.month.toString().padLeft(2, '0')}-${toDate!.day.toString().padLeft(2, '0')}",
|
|
"position": position?.toJson(),
|
|
"from_date": "${fromDate!.year.toString().padLeft(4, '0')}-${fromDate!.month.toString().padLeft(2, '0')}-${fromDate!.day.toString().padLeft(2, '0')}",
|
|
// "attachments": attachments,
|
|
"salary_grade": salaryGrade,
|
|
"monthly_salary": monthlySalary,
|
|
"appointment_status": appointmentStatus,
|
|
};
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|