forked from Yara724/api
Initial commit after migration to gitea
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import mongoose, { Types } from "mongoose";
|
||||
|
||||
@Schema({ versionKey: false })
|
||||
export class ActionUserModel extends mongoose.Document {
|
||||
@Prop({ required: true, type: Types.ObjectId })
|
||||
userId: Types.ObjectId;
|
||||
|
||||
@Prop({ required: true, type: Date })
|
||||
date: Date;
|
||||
}
|
||||
|
||||
export const ActionActorSchema = SchemaFactory.createForClass(ActionUserModel);
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Prop, Schema } from "@nestjs/mongoose";
|
||||
|
||||
@Schema({ versionKey: false, _id: true })
|
||||
export class AiImagesModel {
|
||||
@Prop({ type: "array" })
|
||||
imagesAddress: string[];
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import mongoose, { Types } from "mongoose";
|
||||
|
||||
@Schema({ versionKey: false, collection: "car-green-cards" })
|
||||
export class CarGreenCardModel extends mongoose.Document {
|
||||
@Prop({ required: false, type: String })
|
||||
path?: string;
|
||||
|
||||
@Prop({ required: false, type: String })
|
||||
fileName?: string;
|
||||
|
||||
@Prop({ required: false, type: Types.ObjectId })
|
||||
claimId?: Types.ObjectId;
|
||||
}
|
||||
|
||||
export const CarGreenCardSchema =
|
||||
SchemaFactory.createForClass(CarGreenCardModel);
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Prop } from "@nestjs/mongoose";
|
||||
|
||||
export class CarDamagePartOtherModel {
|
||||
@Prop({
|
||||
format: "array",
|
||||
description: "please add items of json into array",
|
||||
example: [{ "حسگر درها": true }],
|
||||
})
|
||||
otherParts?: [];
|
||||
}
|
||||
|
||||
export class CarDamagePartModel {
|
||||
@Prop({ type: String })
|
||||
side: string;
|
||||
|
||||
@Prop({ type: String })
|
||||
part: string;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { Prop } from "@nestjs/mongoose";
|
||||
import mongoose, { Types } from "mongoose";
|
||||
import { ActionUserModel } from "./action-user.schema";
|
||||
|
||||
export class ClaimBaseModel extends mongoose.Document {
|
||||
@Prop()
|
||||
readonly _id: Types.ObjectId;
|
||||
|
||||
@Prop()
|
||||
readonly created: Date;
|
||||
|
||||
@Prop({
|
||||
required: false,
|
||||
type: ActionUserModel,
|
||||
})
|
||||
createdBy: ActionUserModel;
|
||||
|
||||
@Prop({ required: false })
|
||||
readonly updated: Date;
|
||||
|
||||
@Prop({
|
||||
required: false,
|
||||
type: [ActionUserModel],
|
||||
})
|
||||
updatedBy: ActionUserModel[];
|
||||
|
||||
@Prop()
|
||||
readonly deleted: boolean;
|
||||
}
|
||||
@@ -0,0 +1,330 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import { Types } from "mongoose";
|
||||
import {
|
||||
CarDetail,
|
||||
RequestManagementModel,
|
||||
} from "src/request-management/entities/schema/request-management.schema";
|
||||
import { UserSignModel } from "src/request-management/entities/schema/sign.schema";
|
||||
import { ReqClaimStatus } from "src/Types&Enums/claim-request-management/status.enum";
|
||||
import { ClaimStepsEnum } from "src/Types&Enums/claim-request-management/steps.enum";
|
||||
import { UserReplyEnum } from "src/Types&Enums/claim-request-management/userReply.enum";
|
||||
import { AiImagesModel } from "./ai-image.schema";
|
||||
import { CarGreenCardModel } from "./car-green-card.schema";
|
||||
import {
|
||||
CarDamagePartModel,
|
||||
CarDamagePartOtherModel,
|
||||
} from "./car-parts.schema";
|
||||
import { ImageRequiredModel } from "./image-required.schema";
|
||||
import { Plates } from "src/Types&Enums/plate.interface";
|
||||
import { AddPlateDto } from "src/profile/dto/user/AddPlateDto";
|
||||
import { FactorStatus } from "src/Types&Enums/claim-request-management/factor-status.enum";
|
||||
import { DaghiOption } from "src/Types&Enums/claim-request-management/daghi-option.enum";
|
||||
|
||||
// main schema
|
||||
export type ClaimRequestManagementDoc = ClaimRequestManagementModel & Document;
|
||||
|
||||
export class EffectedUserReply {
|
||||
@Prop({ required: true, type: String })
|
||||
reply?: UserReplyEnum;
|
||||
|
||||
@Prop({ required: true })
|
||||
signDetail?: UserSignModel;
|
||||
}
|
||||
|
||||
export class UserComment {
|
||||
@Prop({ type: Boolean })
|
||||
isAccept: boolean;
|
||||
|
||||
@Prop({ required: false })
|
||||
signDetail?: Types.ObjectId;
|
||||
}
|
||||
|
||||
export class DaghiDetails {
|
||||
@Prop({ required: true, type: String, enum: DaghiOption })
|
||||
option: DaghiOption;
|
||||
|
||||
@Prop({ required: false, type: String })
|
||||
price?: string;
|
||||
|
||||
@Prop({ required: false, type: Types.ObjectId })
|
||||
branchId?: Types.ObjectId;
|
||||
}
|
||||
|
||||
export class PartsList {
|
||||
@Prop({ required: true, type: String })
|
||||
partId: string;
|
||||
|
||||
@Prop({ required: true, type: String })
|
||||
carPartDamage: string;
|
||||
|
||||
@Prop({ required: true, type: String })
|
||||
typeOfDamage: string;
|
||||
|
||||
@Prop({ required: true, type: String })
|
||||
price: string;
|
||||
|
||||
@Prop({ required: true, type: String })
|
||||
salary: string;
|
||||
|
||||
@Prop({ required: true, type: String })
|
||||
totalPayment: string;
|
||||
|
||||
@Prop({ required: true, type: DaghiDetails })
|
||||
daghi: DaghiDetails;
|
||||
|
||||
@Prop({ required: true, type: Boolean })
|
||||
factorNeeded: boolean;
|
||||
|
||||
@Prop({ type: Types.ObjectId })
|
||||
factorLink?: Types.ObjectId;
|
||||
|
||||
@Prop({ type: String, enum: FactorStatus, default: null })
|
||||
factorStatus?: FactorStatus;
|
||||
|
||||
@Prop({ type: String, default: null })
|
||||
rejectionReason?: string;
|
||||
}
|
||||
|
||||
export class ActorDetail {
|
||||
@Prop()
|
||||
actorName: string;
|
||||
|
||||
@Prop()
|
||||
actorId: string;
|
||||
}
|
||||
|
||||
export class InPersonDocuments {
|
||||
@Prop()
|
||||
NationalCertificate: string;
|
||||
|
||||
@Prop()
|
||||
CarCertificate: string;
|
||||
|
||||
@Prop()
|
||||
DrivingLicense: string;
|
||||
|
||||
@Prop()
|
||||
CarGreenCard: string;
|
||||
}
|
||||
|
||||
export class SubmitReply {
|
||||
@Prop({ required: true })
|
||||
description: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
actorDetail: ActorDetail;
|
||||
|
||||
@Prop({ required: true, type: [PartsList] })
|
||||
parts: PartsList[];
|
||||
|
||||
@Prop({ required: true, default: () => new Date() })
|
||||
submitTime: Date;
|
||||
|
||||
@Prop()
|
||||
userComment?: UserComment;
|
||||
}
|
||||
|
||||
export class ActorLockDetails {
|
||||
@Prop({ type: String })
|
||||
fullName?: string;
|
||||
|
||||
@Prop({ type: Types.ObjectId })
|
||||
actorId?: Types.ObjectId;
|
||||
}
|
||||
|
||||
export class ResendCarPartsDto {
|
||||
@Prop({ required: true })
|
||||
partId: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
partName: string;
|
||||
}
|
||||
|
||||
export class ClaimSubmitResend {
|
||||
@Prop({ required: true })
|
||||
resendDescription: string;
|
||||
|
||||
@Prop({ required: true, type: [InPersonDocuments] })
|
||||
resendDocuments: InPersonDocuments[];
|
||||
|
||||
@Prop({ required: true })
|
||||
resendCarParts: ResendCarPartsDto[];
|
||||
}
|
||||
|
||||
export class UserResendDocuments {
|
||||
@Prop({ required: false })
|
||||
documents: [];
|
||||
|
||||
@Prop({ required: false })
|
||||
carParts: [];
|
||||
}
|
||||
|
||||
export class UserObjection {
|
||||
@Prop({ type: String, required: true })
|
||||
partId: string;
|
||||
|
||||
@Prop({ type: String })
|
||||
reason: string;
|
||||
|
||||
@Prop({ type: String })
|
||||
partPrice: string;
|
||||
|
||||
@Prop({ type: String })
|
||||
partSalary: string;
|
||||
|
||||
@Prop({ type: String })
|
||||
typeOfDamage: string;
|
||||
}
|
||||
|
||||
@Schema({ _id: false })
|
||||
export class FileRating {
|
||||
@Prop({ type: Number, min: 0, max: 5 })
|
||||
collisionMethodAccuracy: number;
|
||||
|
||||
@Prop({ type: Number, min: 0, max: 5 })
|
||||
evaluationTimeliness: number;
|
||||
|
||||
@Prop({ type: Number, min: 0, max: 5 })
|
||||
accidentCauseAccuracy: number;
|
||||
|
||||
@Prop({ type: Number, min: 0, max: 5 })
|
||||
guiltyVehicleIdentification: number;
|
||||
}
|
||||
|
||||
export class PriceDrop {
|
||||
@Prop({ type: Number })
|
||||
total: number;
|
||||
@Prop({ type: Number })
|
||||
carPrice: number;
|
||||
@Prop({ type: Number })
|
||||
carModel: number;
|
||||
@Prop({ type: [Number] })
|
||||
carValue: number[];
|
||||
@Prop({ type: Number })
|
||||
sumOfSeverity: number;
|
||||
}
|
||||
|
||||
@Schema({
|
||||
collection: "claim-requests-management",
|
||||
versionKey: false,
|
||||
timestamps: true,
|
||||
autoIndex: false,
|
||||
})
|
||||
export class ClaimRequestManagementModel {
|
||||
readonly aiImage?: any;
|
||||
constructor() {}
|
||||
@Prop({ type: RequestManagementModel, unique: true })
|
||||
blameFile: RequestManagementModel;
|
||||
|
||||
@Prop({ type: Number, default: 100 })
|
||||
requestNumber?: number;
|
||||
|
||||
@Prop({ type: Types.ObjectId })
|
||||
userClientKey?: Types.ObjectId;
|
||||
|
||||
@Prop({ type: Types.ObjectId })
|
||||
userId: Types.ObjectId;
|
||||
|
||||
@Prop()
|
||||
fullName: string;
|
||||
|
||||
@Prop()
|
||||
carDetail: CarDetail;
|
||||
|
||||
@Prop({ type: AddPlateDto })
|
||||
carPlate: Plates;
|
||||
|
||||
@Prop({})
|
||||
claimStatus: ReqClaimStatus;
|
||||
|
||||
@Prop({})
|
||||
steps: ClaimStepsEnum[];
|
||||
|
||||
@Prop({})
|
||||
currentStep: ClaimStepsEnum;
|
||||
|
||||
@Prop({})
|
||||
nextStep?: ClaimStepsEnum;
|
||||
|
||||
@Prop({ type: CarDamagePartModel })
|
||||
carPartDamage?: CarDamagePartModel[];
|
||||
|
||||
@Prop({ type: CarDamagePartOtherModel })
|
||||
otherParts?: CarDamagePartOtherModel[];
|
||||
|
||||
@Prop({ format: "string" })
|
||||
sheba?: string;
|
||||
|
||||
@Prop({ format: "string" })
|
||||
nationalCodeOfInsurer?: string;
|
||||
|
||||
@Prop({ type: CarGreenCardModel, required: false })
|
||||
carGreenCard?: CarGreenCardModel;
|
||||
|
||||
@Prop({ type: ImageRequiredModel })
|
||||
imageRequired?: ImageRequiredModel;
|
||||
|
||||
@Prop({ type: AiImagesModel })
|
||||
aiImages?: AiImagesModel;
|
||||
|
||||
@Prop({ type: EffectedUserReply })
|
||||
effectedUserReply?: EffectedUserReply;
|
||||
|
||||
@Prop()
|
||||
lockFile?: boolean;
|
||||
|
||||
@Prop({ type: Date })
|
||||
lockTime?: Date | string | number;
|
||||
|
||||
@Prop({ type: Date })
|
||||
unlockTime?: Date | number;
|
||||
|
||||
@Prop()
|
||||
actorLocked?: ActorLockDetails | null;
|
||||
|
||||
@Prop()
|
||||
actorsChecker?: [];
|
||||
|
||||
@Prop({ required: false })
|
||||
videoCaptureId?: Types.ObjectId;
|
||||
|
||||
@Prop({ required: false })
|
||||
damageExpertReply?: SubmitReply | null;
|
||||
|
||||
@Prop({ required: false })
|
||||
damageExpertReplyFinal?: SubmitReply | null;
|
||||
|
||||
@Prop({ required: false, type: ClaimSubmitResend })
|
||||
damageExpertResend?: ClaimSubmitResend | null;
|
||||
|
||||
@Prop({ type: UserObjection, required: false })
|
||||
objection?: UserObjection;
|
||||
|
||||
@Prop({ type: UserResendDocuments })
|
||||
userResendDocuments?: UserResendDocuments;
|
||||
|
||||
@Prop({ type: PriceDrop, required: false })
|
||||
priceDrop?: PriceDrop;
|
||||
|
||||
@Prop({ type: Map, of: Types.ObjectId, required: false })
|
||||
requiredDocuments?: { [key: string]: Types.ObjectId };
|
||||
|
||||
createdAt: any;
|
||||
updatedAt: any;
|
||||
|
||||
@Prop({ type: FileRating, required: false })
|
||||
rating?: FileRating;
|
||||
|
||||
@Prop({ type: String, required: false })
|
||||
visitLocation?: string;
|
||||
|
||||
@Prop({ type: Number, required: false })
|
||||
claimNo?: number;
|
||||
|
||||
@Prop({ type: Number, required: false })
|
||||
claimId?: number;
|
||||
}
|
||||
|
||||
export const ClaimRequestManagementSchema = SchemaFactory.createForClass(
|
||||
ClaimRequestManagementModel,
|
||||
);
|
||||
@@ -0,0 +1,27 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import { Types } from "mongoose";
|
||||
import { ClaimRequiredDocumentType } from "src/Types&Enums/claim-request-management/required-document-type.enum";
|
||||
|
||||
@Schema({ versionKey: false, collection: "claim-required-documents" })
|
||||
export class ClaimRequiredDocument {
|
||||
@Prop({ required: true, type: String })
|
||||
path: string;
|
||||
|
||||
@Prop({ required: true, type: String })
|
||||
fileName: string;
|
||||
|
||||
@Prop({ required: true, type: Types.ObjectId })
|
||||
claimId: Types.ObjectId;
|
||||
|
||||
@Prop({ required: true, enum: ClaimRequiredDocumentType })
|
||||
documentType: ClaimRequiredDocumentType;
|
||||
|
||||
@Prop({ default: () => new Date() })
|
||||
uploadedAt: Date;
|
||||
|
||||
_id?: Types.ObjectId;
|
||||
}
|
||||
|
||||
export const ClaimRequiredDocumentSchema =
|
||||
SchemaFactory.createForClass(ClaimRequiredDocument);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import { UserSignModel } from "src/request-management/entities/schema/sign.schema";
|
||||
|
||||
@Schema({ collection: "claim-sign", versionKey: false })
|
||||
export class ClaimSignModel extends UserSignModel {}
|
||||
export const ClaimSignSchema = SchemaFactory.createForClass(ClaimSignModel);
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
|
||||
export type DamagePartImage = DamagePartImageModel & Document;
|
||||
|
||||
@Schema({ versionKey: false, collection: "damage-part-image" })
|
||||
export class DamagePartImageModel {
|
||||
@Prop({ default: null })
|
||||
path: string | null = null;
|
||||
|
||||
@Prop({ default: null })
|
||||
fileName: string | null = null;
|
||||
|
||||
@Prop({ default: null })
|
||||
claimId: string = null;
|
||||
}
|
||||
|
||||
export const DamageImageModelSchema =
|
||||
SchemaFactory.createForClass(DamagePartImageModel);
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import { Types } from "mongoose";
|
||||
|
||||
@Schema({ versionKey: false, collection: "claim-factors-image" })
|
||||
export class ClaimFactorsImage {
|
||||
@Prop({ required: true, type: String })
|
||||
path: string;
|
||||
|
||||
@Prop({ required: true, type: String })
|
||||
fileName: string;
|
||||
|
||||
@Prop({ required: true, type: Types.ObjectId })
|
||||
claimId: Types.ObjectId;
|
||||
|
||||
@Prop({ required: true, type: String })
|
||||
partId: string;
|
||||
|
||||
@Prop({ required: true, type: Object })
|
||||
partName: any;
|
||||
|
||||
@Prop({ default: () => new Date() })
|
||||
uploadedAt: Date;
|
||||
|
||||
_id?: Types.ObjectId;
|
||||
}
|
||||
|
||||
export const ClaimFactorsImageSchema =
|
||||
SchemaFactory.createForClass(ClaimFactorsImage);
|
||||
@@ -0,0 +1,38 @@
|
||||
import { Prop, Schema } from "@nestjs/mongoose";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
@Schema({ versionKey: false, _id: false })
|
||||
export class ImageRequiredModel {
|
||||
@Prop({ type: "array" })
|
||||
public aroundTheCar = [
|
||||
{ side: "left" },
|
||||
{ side: "back" },
|
||||
{ side: "front" },
|
||||
{ side: "right" },
|
||||
];
|
||||
|
||||
@Prop({ type: "array" })
|
||||
public selectPartOfCar = [];
|
||||
|
||||
@Prop({ type: "string" })
|
||||
public aiReportText: string;
|
||||
|
||||
constructor(claimFile: any[]) {
|
||||
this.aroundTheCar.forEach((a) => {
|
||||
Object.assign(a, {
|
||||
partId: uuidv4(),
|
||||
imageId: null,
|
||||
aiReport: {},
|
||||
upload: false,
|
||||
});
|
||||
});
|
||||
this.selectPartOfCar = claimFile.map((c, idx) =>
|
||||
Object.assign(c, {
|
||||
partId: uuidv4(),
|
||||
aiReport: {},
|
||||
imageId: null,
|
||||
upload: false,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import mongoose, { Types } from "mongoose";
|
||||
|
||||
@Schema({ versionKey: false, collection: "claim-video-capture" })
|
||||
export class VideoCaptureModel extends mongoose.Document {
|
||||
@Prop({ required: false, type: String })
|
||||
path?: string;
|
||||
|
||||
@Prop({ required: false, type: String })
|
||||
fileName?: string;
|
||||
|
||||
@Prop({ required: false, type: Types.ObjectId })
|
||||
claimId?: Types.ObjectId;
|
||||
}
|
||||
|
||||
export const VideoCaptureSchema =
|
||||
SchemaFactory.createForClass(VideoCaptureModel);
|
||||
Reference in New Issue
Block a user