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 53 54 55 56 57 58 59 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Document, Schema as MongooseSchema } from 'mongoose'; @Schema({ collection: 'benefit_plans', timestamps: true }) export class BenefitPlan extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ required: true }) planName!: string; @Prop({ required: true }) planCode!: string; @Prop({ required: true, enum: [ 'insurance', 'meal', 'transport', 'wellness', 'childcare', 'retirement', 'custom', ], }) benefitCategory!: string; @Prop({ default: 0 }) employeeContribution!: number; @Prop({ default: 0 }) employerContribution!: number; @Prop({ default: true }) isActive!: boolean; } export const BenefitPlanSchema = SchemaFactory.createForClass(BenefitPlan); @Schema({ collection: 'benefit_options', timestamps: true }) export class BenefitOption extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) planId!: MongooseSchema.Types.ObjectId; @Prop({ required: true }) optionName!: string; @Prop({ default: 0 }) cost!: number; @Prop() description?: string; } export const BenefitOptionSchema = SchemaFactory.createForClass(BenefitOption); @Schema({ collection: 'employee_benefit_enrollments', timestamps: true }) export class EmployeeBenefitEnrollment 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 }) optionId?: MongooseSchema.Types.ObjectId; @Prop({ required: true }) enrollmentDate!: Date; @Prop() endDate?: Date; @Prop({ default: 'active', enum: ['active', 'cancelled', 'expired'] }) status!: string; } export const EmployeeBenefitEnrollmentSchema = SchemaFactory.createForClass( EmployeeBenefitEnrollment, ); |