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 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Document, Schema as MongooseSchema } from 'mongoose'; @Schema({ collection: 'payroll_inputs', timestamps: true }) export class PayrollInput extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true, index: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) periodId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) employeeId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId }) componentId?: MongooseSchema.Types.ObjectId; @Prop({ required: true, enum: [ 'attendance', 'leave', 'manual', 'import', 'workflow', 'external_api', 'statutory_provider', 'reimbursement', 'loan', 'advance', ], }) source!: string; @Prop({ required: true, enum: ['earning', 'deduction', 'days', 'hours', 'quantity', 'override'], }) inputType!: string; @Prop({ default: 0 }) amount!: number; @Prop({ default: 0 }) quantity!: number; @Prop() remarks?: string; @Prop({ default: 'pending', enum: ['pending', 'validated', 'approved', 'rejected', 'applied'], }) status!: string; @Prop({ type: MongooseSchema.Types.ObjectId }) createdBy?: MongooseSchema.Types.ObjectId; } export const PayrollInputSchema = SchemaFactory.createForClass(PayrollInput); PayrollInputSchema.index({ tenantId: 1, periodId: 1, employeeId: 1 }); PayrollInputSchema.index({ tenantId: 1, periodId: 1, source: 1 }); @Schema({ collection: 'payroll_input_batches', timestamps: true }) export class PayrollInputBatch extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) periodId!: MongooseSchema.Types.ObjectId; @Prop({ required: true }) batchName!: string; @Prop({ required: true, enum: ['attendance', 'leave', 'manual', 'import', 'external'], }) source!: string; @Prop({ default: 0 }) totalRecords!: number; @Prop({ default: 0 }) validRecords!: number; @Prop({ default: 0 }) errorRecords!: number; @Prop({ default: 'pending', enum: ['pending', 'processing', 'completed', 'failed'], }) status!: string; @Prop({ type: MongooseSchema.Types.ObjectId }) createdBy?: MongooseSchema.Types.ObjectId; } export const PayrollInputBatchSchema = SchemaFactory.createForClass(PayrollInputBatch); @Schema({ collection: 'payroll_input_validations', timestamps: true }) export class PayrollInputValidation extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) inputId!: MongooseSchema.Types.ObjectId; @Prop({ required: true, enum: ['error', 'warning', 'info'] }) severity!: string; @Prop({ required: true }) message!: string; @Prop() field?: string; } export const PayrollInputValidationSchema = SchemaFactory.createForClass( PayrollInputValidation, ); // ──────────────────────────────────────────────────────────────── // 8. ATTENDANCE & LEAVE INTEGRATION // ──────────────────────────────────────────────────────────────── |