| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /**
- * * **Current State:** The `Block` schema class model contains a `phaseCode` indexed lookup string that dynamically links blocks to phases.
- * * **Intended Mutation:** Delete the `@Prop` declaration and property for `phaseCode` in the `Block` class (lines 45-46) to achieve a flat schema state.
- * * **Risk Mitigation:** Cross-entity validation is entirely shifted to the `FFB Production` ledger level, making the master block seeder 100% independent.
- */
- import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
- import { Document } from 'mongoose';
- export type PhaseDocument = Phase & Document;
- @Schema()
- export class Phase {
- _id?: string;
- @Prop({ type: Number, required: true })
- locId: number;
- @Prop({ type: String, required: true, unique: true })
- phaseCode: string;
- @Prop({ type: String })
- description: string;
- @Prop({ type: String })
- locType: string;
- blocks?: Block[];
- }
- export const PhaseSchema = SchemaFactory.createForClass(Phase);
- export type BlockDocument = Block & Document;
- @Schema()
- export class Block {
- _id?: string;
- @Prop({ type: Number, required: true })
- locId: number;
- @Prop({ type: String, required: true, unique: true })
- blockCode: string;
- @Prop({ type: String })
- blockDesc: string;
- @Prop({ type: String })
- locType: string;
- @Prop({ type: Number })
- entryNo: number;
- @Prop({ type: Number })
- entryYear: number;
- @Prop({ type: Number })
- quarterPlanted: number;
- @Prop({ type: String })
- monthPlanted: string;
- @Prop({ type: Number })
- totalTrees: number;
- @Prop({ type: Number })
- totalMaturedTrees: number;
- @Prop({ type: Number })
- totalImmaturedTrees: number;
- @Prop({ type: Number })
- totalDeadTrees: number;
- @Prop({ type: Number })
- plantedArea: number;
- @Prop({ type: Number })
- initialPlantedArea: number;
- @Prop({ type: String })
- plantedLocUOM: string;
- @Prop({ type: String })
- soilCondition: string;
- }
- export const BlockSchema = SchemaFactory.createForClass(Block);
|