Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Document, Schema as MongooseSchema } from 'mongoose'; @Schema({ collection: 'finance_budgets', timestamps: true }) export class FinanceBudget extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) legalEntityId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) fiscalYearId!: MongooseSchema.Types.ObjectId; @Prop({ required: true }) budgetName!: string; // e.g. "Departmental Budget 2026" @Prop({ type: MongooseSchema.Types.Map, of: String, default: {} }) dimensions!: Map<string, string>; // e.g. { "DEPT": "HR" } @Prop({ required: true, enum: ['draft', 'approved', 'revised'], default: 'draft' }) status!: string; } export const FinanceBudgetSchema = SchemaFactory.createForClass(FinanceBudget); @Schema({ collection: 'budget_lines', timestamps: true }) export class BudgetLine extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true }) budgetId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) ledgerAccountId!: MongooseSchema.Types.ObjectId; @Prop({ default: 0 }) budgetAmountMinor!: number; @Prop({ default: 0 }) actualAmountMinor!: number; @Prop({ default: 0 }) committedAmountMinor!: number; } export const BudgetLineSchema = SchemaFactory.createForClass(BudgetLine); |