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 114 115 116 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Document, Schema as MongooseSchema } from 'mongoose'; @Schema({ timestamps: true, collection: 'recruitment_offers' }) export class Offer extends Document { @Prop({ required: true, index: true }) tenantId: string; @Prop({ required: true, type: MongooseSchema.Types.ObjectId, ref: 'JobApplication' }) applicationId: string; @Prop({ required: true, type: MongooseSchema.Types.ObjectId, ref: 'Candidate', index: true }) candidateId: string; @Prop({ required: true }) version: number; @Prop({ required: true }) baseSalaryAnnualMinor: number; @Prop({ default: 0 }) variablePayAnnualMinor: number; @Prop({ default: 0 }) joiningBonusMinor: number; @Prop({ required: true }) joiningDate: Date; @Prop({ default: 30 }) probationDays: number; @Prop({ default: 'draft', enum: ['draft', 'approval_pending', 'approved', 'sent', 'viewed', 'negotiation', 'revised', 'accepted', 'rejected', 'withdrawn', 'expired', 'cancelled'] }) status: string; @Prop() signedDocumentFileId?: string; @Prop() expiresAt?: Date; } export const OfferSchema = SchemaFactory.createForClass(Offer); OfferSchema.index({ tenantId: 1, applicationId: 1, version: 1 }, { unique: true }); @Schema({ timestamps: true, collection: 'preboarding_templates' }) export class PreboardingTemplate extends Document { @Prop({ required: true, index: true }) tenantId: string; @Prop({ required: true }) templateName: string; @Prop({ type: [String], default: [] }) requiredTasks: string[]; // List of checklist task codes } export const PreboardingTemplateSchema = SchemaFactory.createForClass(PreboardingTemplate); @Schema({ timestamps: true, collection: 'preboarding_plans' }) export class PreboardingPlan extends Document { @Prop({ required: true, index: true }) tenantId: string; @Prop({ required: true, type: MongooseSchema.Types.ObjectId, ref: 'Candidate', index: true }) candidateId: string; @Prop({ required: true, type: MongooseSchema.Types.ObjectId, ref: 'PreboardingTemplate' }) templateId: string; @Prop({ default: 'initiated', enum: ['initiated', 'completed', 'cancelled'] }) status: string; } export const PreboardingPlanSchema = SchemaFactory.createForClass(PreboardingPlan); PreboardingPlanSchema.index({ tenantId: 1, candidateId: 1 }, { unique: true }); @Schema({ timestamps: true, collection: 'preboarding_tasks' }) export class PreboardingTask extends Document { @Prop({ required: true, index: true }) tenantId: string; @Prop({ required: true, type: MongooseSchema.Types.ObjectId, ref: 'PreboardingPlan' }) planId: string; @Prop({ required: true }) taskName: string; @Prop({ default: 'pending', enum: ['pending', 'completed', 'skipped'] }) status: string; @Prop() uploadedFileId?: string; // e.g. for Document uploads (Identity proof, educational docs) } export const PreboardingTaskSchema = SchemaFactory.createForClass(PreboardingTask); @Schema({ timestamps: true, collection: 'candidate_employee_links' }) export class CandidateEmployeeLink extends Document { @Prop({ required: true, index: true }) tenantId: string; @Prop({ required: true, type: MongooseSchema.Types.ObjectId, ref: 'Candidate', unique: true, index: true }) candidateId: string; @Prop({ required: true, index: true }) employeeId: string; // HR employee ID @Prop({ required: true }) linkedAt: Date; } export const CandidateEmployeeLinkSchema = SchemaFactory.createForClass(CandidateEmployeeLink); CandidateEmployeeLinkSchema.index({ tenantId: 1, candidateId: 1 }, { unique: true }); CandidateEmployeeLinkSchema.index({ tenantId: 1, employeeId: 1 }, { unique: true }); |