All files / src/domains/hr/payroll/benefits/schemas flexible-benefit.schema.ts

0% Statements 0/31
0% Branches 0/48
100% Functions 0/0
0% Lines 0/25

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 48 49 50 51 52                                                                                                       
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Schema as MongooseSchema } from 'mongoose';
 
@Schema({ collection: 'flexible_benefit_plans', timestamps: true })
export class FlexibleBenefitPlan extends Document {
  @Prop({ type: MongooseSchema.Types.ObjectId, required: true })
  tenantId!: MongooseSchema.Types.ObjectId;
  @Prop({ required: true }) planName!: string;
  @Prop({ default: 0 }) totalAllowance!: number;
  @Prop({ default: true }) isActive!: boolean;
  @Prop() enrollmentWindowStart?: Date;
  @Prop() enrollmentWindowEnd?: Date;
}
export const FlexibleBenefitPlanSchema =
  SchemaFactory.createForClass(FlexibleBenefitPlan);
 
@Schema({ collection: 'flexible_benefit_allocations', timestamps: true })
export class FlexibleBenefitAllocation extends Document {
  @Prop({ type: MongooseSchema.Types.ObjectId, required: true })
  tenantId!: MongooseSchema.Types.ObjectId;
  @Prop({ type: MongooseSchema.Types.ObjectId, required: true })
  employeeId!: MongooseSchema.Types.ObjectId;
  @Prop({ type: MongooseSchema.Types.ObjectId, required: true })
  planId!: MongooseSchema.Types.ObjectId;
  @Prop({ type: MongooseSchema.Types.ObjectId, required: true })
  componentId!: MongooseSchema.Types.ObjectId;
  @Prop({ default: 0 }) allocatedAmount!: number;
}
export const FlexibleBenefitAllocationSchema = SchemaFactory.createForClass(
  FlexibleBenefitAllocation,
);
 
@Schema({ collection: 'flexible_benefit_claims', timestamps: true })
export class FlexibleBenefitClaim extends Document {
  @Prop({ type: MongooseSchema.Types.ObjectId, required: true })
  tenantId!: MongooseSchema.Types.ObjectId;
  @Prop({ type: MongooseSchema.Types.ObjectId, required: true })
  employeeId!: MongooseSchema.Types.ObjectId;
  @Prop({ type: MongooseSchema.Types.ObjectId, required: true })
  allocationId!: MongooseSchema.Types.ObjectId;
  @Prop({ default: 0 }) claimedAmount!: number;
  @Prop({ default: 'pending', enum: ['pending', 'approved', 'rejected'] })
  status!: string;
  @Prop() receiptFileId?: string;
}
export const FlexibleBenefitClaimSchema =
  SchemaFactory.createForClass(FlexibleBenefitClaim);
 
// ────────────────────────────────────────────────────────────────
// 15. STATUTORY PROVIDERS
// ────────────────────────────────────────────────────────────────