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 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Document, Schema as MongooseSchema } from 'mongoose'; @Schema({ collection: 'payroll_locks', timestamps: true }) export class PayrollLock extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) runId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) lockedBy!: MongooseSchema.Types.ObjectId; @Prop({ required: true }) lockedAt!: Date; @Prop() reason?: string; } export const PayrollLockSchema = SchemaFactory.createForClass(PayrollLock); @Schema({ collection: 'payroll_reopen_requests', timestamps: true }) export class PayrollReopenRequest extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) runId!: MongooseSchema.Types.ObjectId; @Prop({ required: true }) reason!: string; @Prop({ default: 'pending', enum: ['pending', 'approved', 'rejected'] }) status!: string; @Prop({ type: MongooseSchema.Types.ObjectId }) requestedBy?: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId }) approvedBy?: MongooseSchema.Types.ObjectId; } export const PayrollReopenRequestSchema = SchemaFactory.createForClass(PayrollReopenRequest); @Schema({ collection: 'payroll_reopen_approvals', timestamps: true }) export class PayrollReopenApproval extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) reopenRequestId!: 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 PayrollReopenApprovalSchema = SchemaFactory.createForClass( PayrollReopenApproval, ); @Schema({ collection: 'payroll_correction_batches', timestamps: true }) export class PayrollCorrectionBatch extends Document { @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) tenantId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId, required: true }) originalRunId!: MongooseSchema.Types.ObjectId; @Prop({ type: MongooseSchema.Types.ObjectId }) correctionRunId?: MongooseSchema.Types.ObjectId; @Prop({ required: true }) reason!: string; @Prop({ type: [MongooseSchema.Types.ObjectId], default: [] }) affectedEmployeeIds!: MongooseSchema.Types.ObjectId[]; @Prop({ default: 'pending', enum: ['pending', 'processing', 'completed', 'failed'], }) status!: string; } export const PayrollCorrectionBatchSchema = SchemaFactory.createForClass( PayrollCorrectionBatch, ); // ──────────────────────────────────────────────────────────────── // 17. PAYSLIPS // ──────────────────────────────────────────────────────────────── |