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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Document, Schema as MongooseSchema } from 'mongoose'; @Schema({ collection: 'full_and_final_settlements', timestamps: true }) export class FullAndFinalSettlement extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) employeeId!: MongooseSchema.Types.ObjectId; @Prop({ required: true }) lastWorkingDate!: Date; @Prop({ required: true, enum: [ 'resignation', 'termination', 'retirement', 'contract_end', 'absconding', 'other', ], }) separationType!: string; @Prop({ default: 0 }) totalEarnings!: number; @Prop({ default: 0 }) totalRecoveries!: number; @Prop({ default: 0 }) netSettlement!: number; @Prop({ default: 'draft', enum: [ 'draft', 'calculated', 'review_pending', 'approved', 'paid', 'completed', ], }) status!: string; @Prop({ type: MongooseSchema.Types.ObjectId }) approvedBy?: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId }) createdBy?: MongooseSchema.Types.ObjectId; } export const FullAndFinalSettlementSchema = SchemaFactory.createForClass( FullAndFinalSettlement, ); FullAndFinalSettlementSchema.index( { tenantId: 1, employeeId: 1 }, { unique: true }, ); @Schema({ collection: 'settlement_components', timestamps: true }) export class SettlementComponent extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) settlementId!: MongooseSchema.Types.ObjectId; @Prop({ required: true }) componentName!: string; @Prop({ required: true, enum: ['earning', 'recovery'] }) type!: string; @Prop({ default: 0 }) amount!: number; @Prop() remarks?: string; } export const SettlementComponentSchema = SchemaFactory.createForClass(SettlementComponent); @Schema({ collection: 'settlement_recoveries', timestamps: true }) export class SettlementRecovery extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) settlementId!: MongooseSchema.Types.ObjectId; @Prop({ required: true, enum: ['notice_period', 'loan', 'advance', 'asset', 'other'], }) recoveryType!: string; @Prop({ default: 0 }) amount!: number; @Prop() remarks?: string; } export const SettlementRecoverySchema = SchemaFactory.createForClass(SettlementRecovery); @Schema({ collection: 'settlement_approvals', timestamps: true }) export class SettlementApproval extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) settlementId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) approverId!: MongooseSchema.Types.ObjectId; @Prop({ required: true, enum: ['pending', 'approved', 'rejected'] }) status!: string; @Prop() comments?: string; } export const SettlementApprovalSchema = SchemaFactory.createForClass(SettlementApproval); @Schema({ collection: 'settlement_documents', timestamps: true }) export class SettlementDocument extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) settlementId!: MongooseSchema.Types.ObjectId; @Prop({ required: true }) documentType!: string; @Prop() fileId?: string; @Prop() fileName?: string; } export const SettlementDocumentSchema = SchemaFactory.createForClass(SettlementDocument); // ──────────────────────────────────────────────────────────────── // 22. PAYROLL IMPORT & EXPORT // ──────────────────────────────────────────────────────────────── |