| 12345678910111213141516171819202122232425262728293031323334353637 |
- import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
- import { Document, Types } from 'mongoose';
- import { Worker, WorkerSchema } from './worker.schema';
- export type PlantationNodeDocument = PlantationNode & Document;
- @Schema()
- export class PlantationNode {
- @Prop({ required: true, unique: true })
- id: string;
- @Prop({ required: true })
- name: string;
- @Prop()
- location?: string;
- @Prop()
- plantedDate?: Date;
- @Prop({ enum: ['ROOT','SITE','ZONE','BLOCK','TREE'], default: 'BLOCK' })
- type: string;
- @Prop({ enum: ['ACTIVE','INACTIVE','MAINTENANCE'], default: 'ACTIVE' })
- status: string;
- @Prop({ default: '' })
- notes?: string;
- @Prop({ type: [WorkerSchema], default: [] })
- workers: Worker[];
- @Prop({ type: [Types.ObjectId], ref: 'PlantationNode', default: [] })
- childrenNode: PlantationNode[];
- }
- export const PlantationNodeSchema = SchemaFactory.createForClass(PlantationNode);
|