dynamic locations

This commit is contained in:
2026-11-11 14:10:01 +03:30
parent 5e3bd02243
commit 658a8a74cc
18 changed files with 454 additions and 111 deletions
@@ -9,6 +9,19 @@ import { RoleEnum } from "src/Types&Enums/role.enum";
import { UserType } from "src/Types&Enums/userType.enum";
@Schema({ _id: false, versionKey: false })
export class DamageExpertLocationModel {
@Prop({ type: String, required: true })
id: string;
@Prop({ type: String, required: true })
name: string;
}
export const DamageExpertLocationDbSchema = SchemaFactory.createForClass(
DamageExpertLocationModel,
);
@Schema({ _id: false })
export class PersonalInfo {
@Prop({ type: "string" })
@@ -126,6 +139,9 @@ export class DamageExpertModel {
@Prop({ type: Types.ObjectId, index: true })
branchId?: Types.ObjectId;
@Prop({ type: [DamageExpertLocationDbSchema], default: [] })
locations?: DamageExpertLocationModel[];
@Prop({ type: PersonalInfoSchema })
personalInfo?: PersonalInfo;
@@ -4,6 +4,18 @@ 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({})
@@ -69,6 +81,9 @@ export class ExpertModel {
@Prop({ type: Types.ObjectId, index: true })
branchId?: Types.ObjectId;
@Prop({ type: [ExpertLocationDbSchema], default: [] })
locations?: ExpertLocationModel[];
@Prop({ type: "string" })
otp: string;
@@ -2,6 +2,19 @@ import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { Types } from "mongoose";
import { RoleEnum } from "src/Types&Enums/role.enum";
@Schema({ _id: false, versionKey: false })
export class FieldExpertLocationModel {
@Prop({ type: String, required: true })
id: string;
@Prop({ type: String, required: true })
name: string;
}
export const FieldExpertLocationDbSchema = SchemaFactory.createForClass(
FieldExpertLocationModel,
);
@Schema({
collection: "field-expert",
versionKey: false,
@@ -31,6 +44,9 @@ export class FieldExpertModel {
@Prop({ type: Types.ObjectId, index: true })
branchId?: Types.ObjectId;
@Prop({ type: [FieldExpertLocationDbSchema], default: [] })
locations?: FieldExpertLocationModel[];
@Prop({ required: true })
password: string;