YARA-1136

This commit is contained in:
SepehrYahyaee
2026-07-26 11:35:21 +03:30
parent 778544c321
commit 9828aee8af
13 changed files with 707 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { Types } from "mongoose";
import { RoleEnum } from "src/Types&Enums/role.enum";
/**
* Call-center agent actor. Works under an insurance company (clientKey) and
* can start V6 LINK blame files on behalf of callers.
*/
@Schema({
collection: "call-center-agents",
versionKey: false,
timestamps: true,
})
export class CallCenterAgentModel {
_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({ required: true })
password: string;
@Prop({ required: false })
mobile?: string;
@Prop({ required: false })
phone?: string;
@Prop({ default: RoleEnum.CALL_CENTER })
role: RoleEnum;
@Prop({ type: "string", default: "" })
otp: string;
createdAt: Date;
}
export const CallCenterAgentDbSchema =
SchemaFactory.createForClass(CallCenterAgentModel);
CallCenterAgentDbSchema.pre("save", function (next) {
if (!this.username) {
this.username = (this as any).email || (this as any).nationalCode;
}
next();
});