255 lines
6.3 KiB
Dart
255 lines
6.3 KiB
Dart
class JobDetailsResponse {
|
|
final bool success;
|
|
final String message;
|
|
final JobData? data;
|
|
final dynamic errors;
|
|
final int statusCode;
|
|
final String timestamp;
|
|
|
|
JobDetailsResponse({
|
|
required this.success,
|
|
required this.message,
|
|
this.data,
|
|
this.errors,
|
|
required this.statusCode,
|
|
required this.timestamp,
|
|
});
|
|
|
|
factory JobDetailsResponse.fromJson(Map<String, dynamic> json) {
|
|
return JobDetailsResponse(
|
|
success: json['success'] as bool,
|
|
message: json['message'] as String,
|
|
data: json['data'] != null ? JobData.fromJson(json['data']) : null,
|
|
errors: json['errors'],
|
|
statusCode: json['statusCode'] as int,
|
|
timestamp: json['timestamp'] as String,
|
|
);
|
|
}
|
|
}
|
|
|
|
class JobData {
|
|
final String id;
|
|
final String title;
|
|
final String description;
|
|
final String jobTicketUId;
|
|
final Project project;
|
|
final List<Assignee> assignees;
|
|
final Status status;
|
|
final String startDate;
|
|
final String dueDate;
|
|
final bool isActive;
|
|
final dynamic taggingAction;
|
|
final int nextTaggingAction;
|
|
final String createdAt;
|
|
final User createdBy;
|
|
final List<Tag> tags;
|
|
final List<UpdateLog> updateLogs;
|
|
|
|
JobData({
|
|
required this.id,
|
|
required this.title,
|
|
required this.description,
|
|
required this.jobTicketUId,
|
|
required this.project,
|
|
required this.assignees,
|
|
required this.status,
|
|
required this.startDate,
|
|
required this.dueDate,
|
|
required this.isActive,
|
|
this.taggingAction,
|
|
required this.nextTaggingAction,
|
|
required this.createdAt,
|
|
required this.createdBy,
|
|
required this.tags,
|
|
required this.updateLogs,
|
|
});
|
|
|
|
factory JobData.fromJson(Map<String, dynamic> json) {
|
|
return JobData(
|
|
id: json['id'] as String,
|
|
title: json['title'] as String,
|
|
description: json['description'] as String,
|
|
jobTicketUId: json['jobTicketUId'] as String,
|
|
project: Project.fromJson(json['project']),
|
|
assignees: (json['assignees'] as List<dynamic>)
|
|
.map((e) => Assignee.fromJson(e))
|
|
.toList(),
|
|
status: Status.fromJson(json['status']),
|
|
startDate: json['startDate'] as String,
|
|
dueDate: json['dueDate'] as String,
|
|
isActive: json['isActive'] as bool,
|
|
taggingAction: json['taggingAction'],
|
|
nextTaggingAction: json['nextTaggingAction'] as int,
|
|
createdAt: json['createdAt'] as String,
|
|
createdBy: User.fromJson(json['createdBy']),
|
|
tags:
|
|
(json['tags'] as List<dynamic>).map((e) => Tag.fromJson(e)).toList(),
|
|
updateLogs: (json['updateLogs'] as List<dynamic>)
|
|
.map((e) => UpdateLog.fromJson(e))
|
|
.toList(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class Project {
|
|
final String id;
|
|
final String name;
|
|
final String shortName;
|
|
final String assignedDate;
|
|
final String contactName;
|
|
final String contactPhone;
|
|
final String contactEmail;
|
|
|
|
Project({
|
|
required this.id,
|
|
required this.name,
|
|
required this.shortName,
|
|
required this.assignedDate,
|
|
required this.contactName,
|
|
required this.contactPhone,
|
|
required this.contactEmail,
|
|
});
|
|
|
|
factory Project.fromJson(Map<String, dynamic> json) {
|
|
return Project(
|
|
id: json['id'] as String,
|
|
name: json['name'] as String,
|
|
shortName: json['shortName'] as String,
|
|
assignedDate: json['assignedDate'] as String,
|
|
contactName: json['contactName'] as String,
|
|
contactPhone: json['contactPhone'] as String,
|
|
contactEmail: json['contactEmail'] as String,
|
|
);
|
|
}
|
|
}
|
|
|
|
class Assignee {
|
|
final String id;
|
|
final String firstName;
|
|
final String lastName;
|
|
final String email;
|
|
final String photo;
|
|
final String jobRoleId;
|
|
final String jobRoleName;
|
|
|
|
Assignee({
|
|
required this.id,
|
|
required this.firstName,
|
|
required this.lastName,
|
|
required this.email,
|
|
required this.photo,
|
|
required this.jobRoleId,
|
|
required this.jobRoleName,
|
|
});
|
|
|
|
factory Assignee.fromJson(Map<String, dynamic> json) {
|
|
return Assignee(
|
|
id: json['id'] as String,
|
|
firstName: json['firstName'] as String,
|
|
lastName: json['lastName'] as String,
|
|
email: json['email'] as String,
|
|
photo: json['photo'] as String,
|
|
jobRoleId: json['jobRoleId'] as String,
|
|
jobRoleName: json['jobRoleName'] as String,
|
|
);
|
|
}
|
|
}
|
|
|
|
class Status {
|
|
final String id;
|
|
final String name;
|
|
final String displayName;
|
|
final int level;
|
|
|
|
Status({
|
|
required this.id,
|
|
required this.name,
|
|
required this.displayName,
|
|
required this.level,
|
|
});
|
|
|
|
factory Status.fromJson(Map<String, dynamic> json) {
|
|
return Status(
|
|
id: json['id'] as String,
|
|
name: json['name'] as String,
|
|
displayName: json['displayName'] as String,
|
|
level: json['level'] as int,
|
|
);
|
|
}
|
|
}
|
|
|
|
class User {
|
|
final String id;
|
|
final String firstName;
|
|
final String lastName;
|
|
final String email;
|
|
final String photo;
|
|
final String jobRoleId;
|
|
final String jobRoleName;
|
|
|
|
User({
|
|
required this.id,
|
|
required this.firstName,
|
|
required this.lastName,
|
|
required this.email,
|
|
required this.photo,
|
|
required this.jobRoleId,
|
|
required this.jobRoleName,
|
|
});
|
|
|
|
factory User.fromJson(Map<String, dynamic> json) {
|
|
return User(
|
|
id: json['id'] as String,
|
|
firstName: json['firstName'] as String,
|
|
lastName: json['lastName'] as String,
|
|
email: json['email'] as String,
|
|
photo: json['photo'] as String,
|
|
jobRoleId: json['jobRoleId'] as String,
|
|
jobRoleName: json['jobRoleName'] as String,
|
|
);
|
|
}
|
|
}
|
|
|
|
class Tag {
|
|
final String id;
|
|
final String name;
|
|
|
|
Tag({
|
|
required this.id,
|
|
required this.name,
|
|
});
|
|
|
|
factory Tag.fromJson(Map<String, dynamic> json) {
|
|
return Tag(
|
|
id: json['id'] as String,
|
|
name: json['name'] as String,
|
|
);
|
|
}
|
|
}
|
|
|
|
class UpdateLog {
|
|
final String id;
|
|
final Status? status;
|
|
final Status nextStatus;
|
|
final String comment;
|
|
final User updatedBy;
|
|
|
|
UpdateLog({
|
|
required this.id,
|
|
this.status,
|
|
required this.nextStatus,
|
|
required this.comment,
|
|
required this.updatedBy,
|
|
});
|
|
|
|
factory UpdateLog.fromJson(Map<String, dynamic> json) {
|
|
return UpdateLog(
|
|
id: json['id'] as String,
|
|
status: json['status'] != null ? Status.fromJson(json['status']) : null,
|
|
nextStatus: Status.fromJson(json['nextStatus']),
|
|
comment: json['comment'] as String,
|
|
updatedBy: User.fromJson(json['updatedBy']),
|
|
);
|
|
}
|
|
}
|