add auth, format
This commit is contained in:
@@ -7,51 +7,103 @@ part 'design_request_model.g.dart';
|
||||
|
||||
@HiveType(typeId: HiveTypeIds.designRequestModel)
|
||||
class DesignRequestModel extends HiveObject {
|
||||
DesignRequestModel({required this.requestId, required this.userId, required this.projectName, required this.projectType, required this.area, required this.style, required this.budget, required this.currentSituation, required this.requirements, this.notes, this.attachments, required this.status, this.assignedDesigner, this.finalDesignLink, this.feedback, this.rating, this.estimatedCompletion, required this.createdAt, this.completedAt, this.updatedAt});
|
||||
|
||||
@HiveField(0) final String requestId;
|
||||
@HiveField(1) final String userId;
|
||||
@HiveField(2) final String projectName;
|
||||
@HiveField(3) final ProjectType projectType;
|
||||
@HiveField(4) final double area;
|
||||
@HiveField(5) final String style;
|
||||
@HiveField(6) final double budget;
|
||||
@HiveField(7) final String currentSituation;
|
||||
@HiveField(8) final String requirements;
|
||||
@HiveField(9) final String? notes;
|
||||
@HiveField(10) final String? attachments;
|
||||
@HiveField(11) final DesignStatus status;
|
||||
@HiveField(12) final String? assignedDesigner;
|
||||
@HiveField(13) final String? finalDesignLink;
|
||||
@HiveField(14) final String? feedback;
|
||||
@HiveField(15) final int? rating;
|
||||
@HiveField(16) final DateTime? estimatedCompletion;
|
||||
@HiveField(17) final DateTime createdAt;
|
||||
@HiveField(18) final DateTime? completedAt;
|
||||
@HiveField(19) final DateTime? updatedAt;
|
||||
DesignRequestModel({
|
||||
required this.requestId,
|
||||
required this.userId,
|
||||
required this.projectName,
|
||||
required this.projectType,
|
||||
required this.area,
|
||||
required this.style,
|
||||
required this.budget,
|
||||
required this.currentSituation,
|
||||
required this.requirements,
|
||||
this.notes,
|
||||
this.attachments,
|
||||
required this.status,
|
||||
this.assignedDesigner,
|
||||
this.finalDesignLink,
|
||||
this.feedback,
|
||||
this.rating,
|
||||
this.estimatedCompletion,
|
||||
required this.createdAt,
|
||||
this.completedAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
factory DesignRequestModel.fromJson(Map<String, dynamic> json) => DesignRequestModel(
|
||||
requestId: json['request_id'] as String,
|
||||
userId: json['user_id'] as String,
|
||||
projectName: json['project_name'] as String,
|
||||
projectType: ProjectType.values.firstWhere((e) => e.name == json['project_type']),
|
||||
area: (json['area'] as num).toDouble(),
|
||||
style: json['style'] as String,
|
||||
budget: (json['budget'] as num).toDouble(),
|
||||
currentSituation: json['current_situation'] as String,
|
||||
requirements: json['requirements'] as String,
|
||||
notes: json['notes'] as String?,
|
||||
attachments: json['attachments'] != null ? jsonEncode(json['attachments']) : null,
|
||||
status: DesignStatus.values.firstWhere((e) => e.name == json['status']),
|
||||
assignedDesigner: json['assigned_designer'] as String?,
|
||||
finalDesignLink: json['final_design_link'] as String?,
|
||||
feedback: json['feedback'] as String?,
|
||||
rating: json['rating'] as int?,
|
||||
estimatedCompletion: json['estimated_completion'] != null ? DateTime.parse(json['estimated_completion']?.toString() ?? '') : null,
|
||||
createdAt: DateTime.parse(json['created_at']?.toString() ?? ''),
|
||||
completedAt: json['completed_at'] != null ? DateTime.parse(json['completed_at']?.toString() ?? '') : null,
|
||||
updatedAt: json['updated_at'] != null ? DateTime.parse(json['updated_at']?.toString() ?? '') : null,
|
||||
);
|
||||
@HiveField(0)
|
||||
final String requestId;
|
||||
@HiveField(1)
|
||||
final String userId;
|
||||
@HiveField(2)
|
||||
final String projectName;
|
||||
@HiveField(3)
|
||||
final ProjectType projectType;
|
||||
@HiveField(4)
|
||||
final double area;
|
||||
@HiveField(5)
|
||||
final String style;
|
||||
@HiveField(6)
|
||||
final double budget;
|
||||
@HiveField(7)
|
||||
final String currentSituation;
|
||||
@HiveField(8)
|
||||
final String requirements;
|
||||
@HiveField(9)
|
||||
final String? notes;
|
||||
@HiveField(10)
|
||||
final String? attachments;
|
||||
@HiveField(11)
|
||||
final DesignStatus status;
|
||||
@HiveField(12)
|
||||
final String? assignedDesigner;
|
||||
@HiveField(13)
|
||||
final String? finalDesignLink;
|
||||
@HiveField(14)
|
||||
final String? feedback;
|
||||
@HiveField(15)
|
||||
final int? rating;
|
||||
@HiveField(16)
|
||||
final DateTime? estimatedCompletion;
|
||||
@HiveField(17)
|
||||
final DateTime createdAt;
|
||||
@HiveField(18)
|
||||
final DateTime? completedAt;
|
||||
@HiveField(19)
|
||||
final DateTime? updatedAt;
|
||||
|
||||
factory DesignRequestModel.fromJson(Map<String, dynamic> json) =>
|
||||
DesignRequestModel(
|
||||
requestId: json['request_id'] as String,
|
||||
userId: json['user_id'] as String,
|
||||
projectName: json['project_name'] as String,
|
||||
projectType: ProjectType.values.firstWhere(
|
||||
(e) => e.name == json['project_type'],
|
||||
),
|
||||
area: (json['area'] as num).toDouble(),
|
||||
style: json['style'] as String,
|
||||
budget: (json['budget'] as num).toDouble(),
|
||||
currentSituation: json['current_situation'] as String,
|
||||
requirements: json['requirements'] as String,
|
||||
notes: json['notes'] as String?,
|
||||
attachments: json['attachments'] != null
|
||||
? jsonEncode(json['attachments'])
|
||||
: null,
|
||||
status: DesignStatus.values.firstWhere((e) => e.name == json['status']),
|
||||
assignedDesigner: json['assigned_designer'] as String?,
|
||||
finalDesignLink: json['final_design_link'] as String?,
|
||||
feedback: json['feedback'] as String?,
|
||||
rating: json['rating'] as int?,
|
||||
estimatedCompletion: json['estimated_completion'] != null
|
||||
? DateTime.parse(json['estimated_completion']?.toString() ?? '')
|
||||
: null,
|
||||
createdAt: DateTime.parse(json['created_at']?.toString() ?? ''),
|
||||
completedAt: json['completed_at'] != null
|
||||
? DateTime.parse(json['completed_at']?.toString() ?? '')
|
||||
: null,
|
||||
updatedAt: json['updated_at'] != null
|
||||
? DateTime.parse(json['updated_at']?.toString() ?? '')
|
||||
: null,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'request_id': requestId,
|
||||
|
||||
@@ -7,41 +7,84 @@ part 'project_submission_model.g.dart';
|
||||
|
||||
@HiveType(typeId: HiveTypeIds.projectSubmissionModel)
|
||||
class ProjectSubmissionModel extends HiveObject {
|
||||
ProjectSubmissionModel({required this.submissionId, required this.userId, required this.projectName, required this.projectAddress, required this.projectValue, required this.projectType, this.beforePhotos, this.afterPhotos, this.invoices, required this.status, this.reviewNotes, this.rejectionReason, this.pointsEarned, required this.submittedAt, this.reviewedAt, this.reviewedBy});
|
||||
|
||||
@HiveField(0) final String submissionId;
|
||||
@HiveField(1) final String userId;
|
||||
@HiveField(2) final String projectName;
|
||||
@HiveField(3) final String projectAddress;
|
||||
@HiveField(4) final double projectValue;
|
||||
@HiveField(5) final ProjectType projectType;
|
||||
@HiveField(6) final String? beforePhotos;
|
||||
@HiveField(7) final String? afterPhotos;
|
||||
@HiveField(8) final String? invoices;
|
||||
@HiveField(9) final SubmissionStatus status;
|
||||
@HiveField(10) final String? reviewNotes;
|
||||
@HiveField(11) final String? rejectionReason;
|
||||
@HiveField(12) final int? pointsEarned;
|
||||
@HiveField(13) final DateTime submittedAt;
|
||||
@HiveField(14) final DateTime? reviewedAt;
|
||||
@HiveField(15) final String? reviewedBy;
|
||||
ProjectSubmissionModel({
|
||||
required this.submissionId,
|
||||
required this.userId,
|
||||
required this.projectName,
|
||||
required this.projectAddress,
|
||||
required this.projectValue,
|
||||
required this.projectType,
|
||||
this.beforePhotos,
|
||||
this.afterPhotos,
|
||||
this.invoices,
|
||||
required this.status,
|
||||
this.reviewNotes,
|
||||
this.rejectionReason,
|
||||
this.pointsEarned,
|
||||
required this.submittedAt,
|
||||
this.reviewedAt,
|
||||
this.reviewedBy,
|
||||
});
|
||||
|
||||
factory ProjectSubmissionModel.fromJson(Map<String, dynamic> json) => ProjectSubmissionModel(
|
||||
@HiveField(0)
|
||||
final String submissionId;
|
||||
@HiveField(1)
|
||||
final String userId;
|
||||
@HiveField(2)
|
||||
final String projectName;
|
||||
@HiveField(3)
|
||||
final String projectAddress;
|
||||
@HiveField(4)
|
||||
final double projectValue;
|
||||
@HiveField(5)
|
||||
final ProjectType projectType;
|
||||
@HiveField(6)
|
||||
final String? beforePhotos;
|
||||
@HiveField(7)
|
||||
final String? afterPhotos;
|
||||
@HiveField(8)
|
||||
final String? invoices;
|
||||
@HiveField(9)
|
||||
final SubmissionStatus status;
|
||||
@HiveField(10)
|
||||
final String? reviewNotes;
|
||||
@HiveField(11)
|
||||
final String? rejectionReason;
|
||||
@HiveField(12)
|
||||
final int? pointsEarned;
|
||||
@HiveField(13)
|
||||
final DateTime submittedAt;
|
||||
@HiveField(14)
|
||||
final DateTime? reviewedAt;
|
||||
@HiveField(15)
|
||||
final String? reviewedBy;
|
||||
|
||||
factory ProjectSubmissionModel.fromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => ProjectSubmissionModel(
|
||||
submissionId: json['submission_id'] as String,
|
||||
userId: json['user_id'] as String,
|
||||
projectName: json['project_name'] as String,
|
||||
projectAddress: json['project_address'] as String,
|
||||
projectValue: (json['project_value'] as num).toDouble(),
|
||||
projectType: ProjectType.values.firstWhere((e) => e.name == json['project_type']),
|
||||
beforePhotos: json['before_photos'] != null ? jsonEncode(json['before_photos']) : null,
|
||||
afterPhotos: json['after_photos'] != null ? jsonEncode(json['after_photos']) : null,
|
||||
projectType: ProjectType.values.firstWhere(
|
||||
(e) => e.name == json['project_type'],
|
||||
),
|
||||
beforePhotos: json['before_photos'] != null
|
||||
? jsonEncode(json['before_photos'])
|
||||
: null,
|
||||
afterPhotos: json['after_photos'] != null
|
||||
? jsonEncode(json['after_photos'])
|
||||
: null,
|
||||
invoices: json['invoices'] != null ? jsonEncode(json['invoices']) : null,
|
||||
status: SubmissionStatus.values.firstWhere((e) => e.name == json['status']),
|
||||
reviewNotes: json['review_notes'] as String?,
|
||||
rejectionReason: json['rejection_reason'] as String?,
|
||||
pointsEarned: json['points_earned'] as int?,
|
||||
submittedAt: DateTime.parse(json['submitted_at']?.toString() ?? ''),
|
||||
reviewedAt: json['reviewed_at'] != null ? DateTime.parse(json['reviewed_at']?.toString() ?? '') : null,
|
||||
reviewedAt: json['reviewed_at'] != null
|
||||
? DateTime.parse(json['reviewed_at']?.toString() ?? '')
|
||||
: null,
|
||||
reviewedBy: json['reviewed_by'] as String?,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user