1
0
forked from Yara724/api

Added fileMaker and fileReviewer for new flow

This commit is contained in:
SepehrYahyaee
2026-06-30 13:54:21 +03:30
parent f3686575ca
commit 65e7476642
16 changed files with 1232 additions and 2 deletions

View File

@@ -0,0 +1,68 @@
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { Types } from "mongoose";
import { RoleEnum } from "src/Types&Enums/role.enum";
@Schema({
collection: "file-reviewer",
versionKey: false,
timestamps: true,
})
export class FileReviewerModel {
_id?: Types.ObjectId;
@Prop({ required: true })
firstName: string;
@Prop({ required: true })
lastName: string;
@Prop({ type: String, unique: true, sparse: true, required: false })
email?: string;
@Prop({ type: String })
username?: string;
@Prop({ type: String, index: true, sparse: true })
nationalCode?: string;
@Prop({ type: Types.ObjectId, index: true })
clientKey?: Types.ObjectId;
@Prop({ type: Types.ObjectId, index: true })
branchId?: Types.ObjectId;
@Prop({ required: true })
password: string;
@Prop({ required: false })
mobile?: string;
@Prop({ required: false })
phone?: string;
@Prop({ default: RoleEnum.FILE_REVIEWER })
role: RoleEnum;
@Prop({ type: "string", default: "" })
otp: string;
@Prop({ type: "string", required: false })
expertCode?: string;
createdAt: Date;
}
export const FileReviewerDbSchema =
SchemaFactory.createForClass(FileReviewerModel);
FileReviewerDbSchema.index(
{ clientKey: 1, nationalCode: 1 },
{ unique: true, sparse: true },
);
FileReviewerDbSchema.pre("save", function (next) {
if (!this.username) {
this.username = (this as any).email || (this as any).nationalCode;
}
next();
});