Files
yara724api/src/users/entities/schema/expert.schema.ts
T
SepehrYahyaee 83376df4ad feat: manage expert access and merge Parsian expert seeds
Allow role-specific identities and admin account activation, support national-code-only claim experts, and remove required voice from v4/v5. Add a combined, resumable Parsian seed that preserves existing accounts and merges locations and product codes.
2026-11-18 17:16:26 +03:30

112 lines
2.1 KiB
TypeScript

import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { Types } from "mongoose";
import { Degrees } from "src/Types&Enums/degrees.enum";
import { RoleEnum } from "src/Types&Enums/role.enum";
import { UserType } from "src/Types&Enums/userType.enum";
@Schema({ _id: false, versionKey: false })
export class ExpertLocationModel {
@Prop({ type: String, required: true })
id: string;
@Prop({ type: String, required: true })
name: string;
}
export const ExpertLocationDbSchema =
SchemaFactory.createForClass(ExpertLocationModel);
@Schema({ collection: "expert", versionKey: false, timestamps: true })
export class ExpertModel {
@Prop({ type: Boolean, default: true })
isActive?: boolean;
@Prop({})
firstName: string;
@Prop({})
role: RoleEnum;
@Prop({})
userType: UserType;
@Prop({})
lastName: string;
@Prop({ unique: true })
nationalCode: string;
@Prop({ type: "string", unique: true })
email: string;
@Prop({})
password: string;
@Prop({})
sheba: string;
@Prop({})
phone: string;
@Prop({})
mobile: string;
@Prop({})
city: string;
@Prop({})
state: string;
@Prop({})
address: string;
@Prop({ type: String })
expDegree: Degrees;
@Prop({})
insuActivityTime?: number;
@Prop({})
insuActivityCo?: string;
@Prop({})
policeActivityTime?: number;
@Prop({})
policeActivityKind?: string;
@Prop({})
policeServicePlace?: string;
@Prop({})
clientKey?: string;
@Prop({ type: Types.ObjectId, index: true })
branchId?: Types.ObjectId;
@Prop({ type: [ExpertLocationDbSchema], default: [] })
locations?: ExpertLocationModel[];
@Prop({ type: "string" })
otp: string;
@Prop({ type: "string", required: false })
expertCode?: string;
@Prop({ type: String, required: false })
ThirdPartyClaimExpertId?: string;
@Prop({ type: String, required: false })
CarBodyClaimExpertId?: string;
@Prop({ type: String, required: false })
ThirdPartyExpertiseClaim?: string;
@Prop({ type: String, required: false })
CarBodyExpertiseClaim?: string;
createdAt: Date;
}
export const ExpertDbSchema = SchemaFactory.createForClass(ExpertModel);