add auth, format
This commit is contained in:
@@ -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