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'; export type LeaveTypeDocument = LeaveType & Document; @Schema({ collection: 'leave_types', timestamps: true }) export class LeaveType { @Prop({ required: true }) tenantId: string; @Prop({ required: true }) leaveTypeCode: string; @Prop({ required: true }) leaveTypeName: string; @Prop() shortName: string; @Prop() description: string; @Prop({ required: true, enum: [ 'Annual Leave', 'Casual Leave', 'Sick Leave', 'Earned Leave', 'Privilege Leave', 'Unpaid Leave', 'Loss of Pay', 'Maternity Leave', 'Paternity Leave', 'Adoption Leave', 'Bereavement Leave', 'Marriage Leave', 'Study Leave', 'Compensatory Off', 'Optional Holiday', 'Restricted Holiday', 'Work Injury Leave', 'Medical Leave', 'Special Leave', 'Sabbatical', 'Other', ], }) category: string; @Prop() color: string; @Prop() icon: string; @Prop({ default: true }) paid: boolean; @Prop({ default: false }) unpaid: boolean; @Prop({ default: false }) statutory: boolean; @Prop({ default: false }) optionalHoliday: boolean; @Prop({ default: false }) compensatory: boolean; @Prop({ default: false }) encashable: boolean; @Prop({ default: false }) carryForwardAllowed: boolean; @Prop({ default: false }) negativeBalanceAllowed: boolean; @Prop({ default: false }) documentRequired: boolean; @Prop({ default: false }) reasonRequired: boolean; @Prop({ default: true }) approvalRequired: boolean; @Prop({ enum: ['deduct', 'no_impact', 'mark_present'], default: 'deduct' }) attendanceImpact: string; @Prop({ enum: ['paid_leave', 'unpaid_leave', 'no_impact'], default: 'paid_leave', }) payrollImpact: string; @Prop({ enum: ['All', 'Male', 'Female', 'Other'], default: 'All' }) genderRestriction: string; @Prop({ enum: ['All', 'Married', 'Single'], default: 'All' }) maritalStatusRestriction: string; @Prop({ default: 0 }) minimumServiceDays: number; @Prop({ default: null }) maximumServiceDays: number; @Prop({ default: 0 }) minimumRequestDuration: number; @Prop({ default: null }) maximumRequestDuration: number; @Prop({ enum: ['Full Day', 'Half Day', 'Hour', 'Minute', 'Mixed'], default: 'Full Day', }) unit: string; @Prop({ enum: ['active', 'inactive'], default: 'active' }) status: string; @Prop() effectiveFrom: Date; @Prop() effectiveTo: Date; @Prop({ default: false }) deleted: boolean; @Prop() deletedAt: Date; @Prop() createdBy: string; @Prop() updatedBy: string; } export const LeaveTypeSchema = SchemaFactory.createForClass(LeaveType); LeaveTypeSchema.index({ tenantId: 1, leaveTypeCode: 1 }, { unique: true }); LeaveTypeSchema.index({ tenantId: 1, status: 1 }); LeaveTypeSchema.index({ tenantId: 1, category: 1 }); |