forked from Yara724/api
dynamic locations
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user