forked from Yara724/api
Initial commit after migration to gitea
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { FilterQuery, Model } from "mongoose";
|
||||
import { CarGreenCardModel } from "src/claim-request-management/entites/schema/car-green-card.schema";
|
||||
|
||||
export class CarGreenCardDbService {
|
||||
constructor(
|
||||
@InjectModel(CarGreenCardModel.name)
|
||||
private readonly model: Model<CarGreenCardModel>,
|
||||
) {}
|
||||
async create(greenCard): Promise<CarGreenCardModel> {
|
||||
return await this.model.create(greenCard);
|
||||
}
|
||||
|
||||
async findOne(
|
||||
filter: FilterQuery<CarGreenCardModel>,
|
||||
): Promise<CarGreenCardModel> {
|
||||
return await this.model.findOne({ filter });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { FilterQuery, Model, Types, UpdateQuery } from "mongoose";
|
||||
import { ClaimRequestManagementModel } from "src/claim-request-management/entites/schema/claim-request-management.schema";
|
||||
const crypto = require("node:crypto");
|
||||
|
||||
@Injectable()
|
||||
export class ClaimRequestManagementDbService {
|
||||
constructor(
|
||||
@InjectModel(ClaimRequestManagementModel.name)
|
||||
private readonly model: Model<ClaimRequestManagementModel>,
|
||||
) {}
|
||||
|
||||
async create(
|
||||
claimRequest: ClaimRequestManagementModel,
|
||||
): Promise<ClaimRequestManagementModel> {
|
||||
const uniqueRequestNumber = await this.generateUniqueNumbers();
|
||||
return this.model.create({
|
||||
...claimRequest,
|
||||
requestNumber: uniqueRequestNumber,
|
||||
});
|
||||
}
|
||||
|
||||
async findOne(
|
||||
id?: string,
|
||||
filter?: FilterQuery<ClaimRequestManagementModel>,
|
||||
) {
|
||||
if (filter) return await this.model.findOne(filter);
|
||||
return await this.model.findOne({ _id: new Types.ObjectId(id) });
|
||||
}
|
||||
|
||||
async findOneDocument(
|
||||
id: string,
|
||||
filter?: FilterQuery<ClaimRequestManagementModel>,
|
||||
) {
|
||||
if (filter) return await this.model.findOne(filter);
|
||||
return await this.model.findOne({ _id: new Types.ObjectId(id) }).lean();
|
||||
}
|
||||
|
||||
async findOneAndUpdate(
|
||||
filter: FilterQuery<ClaimRequestManagementModel>,
|
||||
update: UpdateQuery<ClaimRequestManagementModel>,
|
||||
option?,
|
||||
) {
|
||||
return await this.model.findOneAndUpdate(filter, update, option);
|
||||
}
|
||||
|
||||
async findAllByStatus(filter: FilterQuery<ClaimRequestManagementModel>) {
|
||||
return await this.model.find(filter);
|
||||
}
|
||||
|
||||
async findAndDelete(
|
||||
filter: FilterQuery<ClaimRequestManagementModel>,
|
||||
option,
|
||||
) {
|
||||
return await this.model.deleteMany(filter, option);
|
||||
}
|
||||
|
||||
async findAllAndPagination(
|
||||
filter: FilterQuery<ClaimRequestManagementModel>,
|
||||
currentPage: number,
|
||||
countPerPage: number,
|
||||
) {
|
||||
const responsePerPage = countPerPage | 1;
|
||||
const skipPge = responsePerPage * (Number(currentPage) - 1);
|
||||
return await this.model.find(filter).limit(responsePerPage).skip(skipPge);
|
||||
}
|
||||
|
||||
async aggregate(filter?) {
|
||||
return await this.model.aggregate(filter);
|
||||
}
|
||||
|
||||
async findAndUpdate(
|
||||
id: string,
|
||||
update: UpdateQuery<ClaimRequestManagementModel>,
|
||||
option?: FilterQuery<ClaimRequestManagementModel>,
|
||||
) {
|
||||
return await this.model.findByIdAndUpdate(
|
||||
{ _id: new Types.ObjectId(id) },
|
||||
update,
|
||||
option,
|
||||
);
|
||||
}
|
||||
|
||||
async findAllByAnyFilter(
|
||||
filter: FilterQuery<ClaimRequestManagementModel>,
|
||||
): Promise<ClaimRequestManagementModel[]> {
|
||||
return await this.model.find(filter);
|
||||
}
|
||||
|
||||
async countByFilter(
|
||||
filter: FilterQuery<ClaimRequestManagementModel>,
|
||||
): Promise<number> {
|
||||
return await this.model.countDocuments(filter);
|
||||
}
|
||||
async findAll(): Promise<ClaimRequestManagementModel[]> {
|
||||
return await this.model.find();
|
||||
}
|
||||
async generateUniqueNumbers(digits = 5) {
|
||||
try {
|
||||
const max = Math.pow(10, digits);
|
||||
const randomBytes = crypto.randomBytes(Math.ceil(digits / 2));
|
||||
const randomNumber = parseInt(randomBytes.toString("hex"), 16) % max;
|
||||
return randomNumber.toString().padStart(digits, "0");
|
||||
} catch (error) {
|
||||
console.error("Error generating unique numbers:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async findAllWithFilter(filter?: FilterQuery<ClaimRequestManagementModel>) {
|
||||
return await this.model.find(filter);
|
||||
}
|
||||
|
||||
async findByIdAndUpdate(
|
||||
id: string,
|
||||
updateDto: UpdateQuery<ClaimRequestManagementModel>,
|
||||
): Promise<ClaimRequestManagementModel | null> {
|
||||
return this.model.findByIdAndUpdate(id, updateDto, { new: true }).lean();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { FilterQuery, Model, Types } from "mongoose";
|
||||
import { ClaimRequiredDocument } from "src/claim-request-management/entites/schema/claim-required-document.schema";
|
||||
|
||||
@Injectable()
|
||||
export class ClaimRequiredDocumentDbService {
|
||||
constructor(
|
||||
@InjectModel(ClaimRequiredDocument.name)
|
||||
private readonly model: Model<ClaimRequiredDocument>,
|
||||
) {}
|
||||
|
||||
async create(document: Partial<ClaimRequiredDocument>): Promise<ClaimRequiredDocument> {
|
||||
return await this.model.create(document);
|
||||
}
|
||||
|
||||
async findOne(
|
||||
filter: FilterQuery<ClaimRequiredDocument>,
|
||||
): Promise<ClaimRequiredDocument | null> {
|
||||
return await this.model.findOne(filter);
|
||||
}
|
||||
|
||||
async findAll(
|
||||
filter: FilterQuery<ClaimRequiredDocument>,
|
||||
): Promise<ClaimRequiredDocument[]> {
|
||||
return await this.model.find(filter);
|
||||
}
|
||||
|
||||
async findById(id: string): Promise<ClaimRequiredDocument | null> {
|
||||
return this.model.findById(id).lean();
|
||||
}
|
||||
|
||||
async findByClaimId(claimId: string): Promise<ClaimRequiredDocument[]> {
|
||||
return this.model.find({ claimId: new Types.ObjectId(claimId) });
|
||||
}
|
||||
|
||||
async delete(id: string): Promise<void> {
|
||||
await this.model.findByIdAndDelete(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { FilterQuery, Model } from "mongoose";
|
||||
import { ClaimSignModel } from "src/claim-request-management/entites/schema/claim-sign";
|
||||
|
||||
@Injectable()
|
||||
export class ClaimSignDbService {
|
||||
constructor(
|
||||
@InjectModel(ClaimSignModel.name)
|
||||
private readonly claimSignService: Model<ClaimSignModel>,
|
||||
) {}
|
||||
|
||||
async create(claimSign: ClaimSignModel): Promise<ClaimSignModel> {
|
||||
return await this.claimSignService.create(claimSign);
|
||||
}
|
||||
|
||||
async findOne(filter: FilterQuery<ClaimSignModel>): Promise<ClaimSignModel> {
|
||||
return await this.claimSignService.findOne(filter);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { Model, Types } from "mongoose";
|
||||
import { DamagePartImageModel } from "src/claim-request-management/entites/schema/damage-image-part.schema";
|
||||
|
||||
export class DamageImageDbService {
|
||||
constructor(
|
||||
@InjectModel(DamagePartImageModel.name)
|
||||
private readonly model: Model<DamagePartImageModel>,
|
||||
) {}
|
||||
|
||||
async create(image): Promise<DamagePartImageModel> {
|
||||
return await this.model.create(image);
|
||||
}
|
||||
|
||||
async findOne(id: string): Promise<DamagePartImageModel> {
|
||||
return await this.model.findById(new Types.ObjectId(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { FilterQuery, Model } from "mongoose";
|
||||
import { ClaimFactorsImage } from "src/claim-request-management/entites/schema/factor-image.schema";
|
||||
|
||||
@Injectable()
|
||||
export class ClaimFactorsImageDbService {
|
||||
constructor(
|
||||
@InjectModel(ClaimFactorsImage.name)
|
||||
private readonly model: Model<ClaimFactorsImage>,
|
||||
) {}
|
||||
async create(image): Promise<ClaimFactorsImage> {
|
||||
return await this.model.create(image);
|
||||
}
|
||||
|
||||
async findOne(
|
||||
filter: FilterQuery<ClaimFactorsImage>,
|
||||
): Promise<ClaimFactorsImage> {
|
||||
return await this.model.findOne({ filter });
|
||||
}
|
||||
|
||||
async findById(id: string): Promise<ClaimFactorsImage | null> {
|
||||
return this.model.findById(id).lean();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { FilterQuery, Model } from "mongoose";
|
||||
import { VideoCaptureModel } from "src/claim-request-management/entites/schema/video-capture.schema";
|
||||
|
||||
@Injectable()
|
||||
export class VideoCaptureDbService {
|
||||
constructor(
|
||||
@InjectModel(VideoCaptureModel.name)
|
||||
private readonly videoCapture: Model<VideoCaptureModel>,
|
||||
) {}
|
||||
async create(video): Promise<VideoCaptureModel> {
|
||||
return await this.videoCapture.create(video);
|
||||
}
|
||||
|
||||
async findOne(
|
||||
filter: FilterQuery<VideoCaptureModel>,
|
||||
): Promise<VideoCaptureModel> {
|
||||
return await this.videoCapture.findOne(filter);
|
||||
}
|
||||
|
||||
async findById(id: string): Promise<VideoCaptureModel | null> {
|
||||
return this.videoCapture.findById(id).lean();
|
||||
}
|
||||
}
|
||||
@@ -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