All files / performance/schemas compensation-revisions.schema.ts

100% Statements 22/22
79.16% Branches 19/24
100% Functions 0/0
100% Lines 18/18

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 471x 1x     1x   1x     1x     1x   1x     1x   1x     1x     1x     1x     1x     1x     1x     1x     1x   1x  
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Schema as MongooseSchema } from 'mongoose';
 
@Schema({ timestamps: true, collection: 'performance_increment_policies' })
export class PerformanceIncrementPolicy extends Document {
  @Prop({ required: true, type: MongooseSchema.Types.ObjectId })
  tenantId: MongooseSchema.Types.ObjectId;
 
  @Prop({ required: true })
  name: string;
 
  @Prop({ required: true, type: Number })
  recommendedPercentage: number;
}
export const PerformanceIncrementPolicySchema = SchemaFactory.createForClass(PerformanceIncrementPolicy);
 
@Schema({ timestamps: true, collection: 'performance_recommendations' })
export class PerformanceCompensationRecommendation extends Document {
  @Prop({ required: true, type: MongooseSchema.Types.ObjectId })
  tenantId: MongooseSchema.Types.ObjectId;
 
  @Prop({ required: true, type: MongooseSchema.Types.ObjectId, ref: 'PerformanceCycle' })
  cycleId: MongooseSchema.Types.ObjectId;
 
  @Prop({ required: true, type: MongooseSchema.Types.ObjectId, ref: 'Employee' })
  employeeId: MongooseSchema.Types.ObjectId;
 
  @Prop({ required: true, enum: ['increment', 'promotion', 'bonus'] })
  type: string;
 
  @Prop({ required: true, type: Number })
  recommendedValue: number; // Percentage for increment/promotion, absolute amount for bonus
 
  @Prop({ type: String })
  proposedDesignationId?: string; // Links to Designation if promotion type
 
  @Prop({ required: true, enum: ['draft', 'pending_approval', 'approved', 'rejected'], default: 'draft' })
  status: string;
 
  @Prop({ type: String })
  approvedBy?: string;
 
  @Prop({ type: Date })
  approvedAt?: Date;
}
export const PerformanceCompensationRecommendationSchema = SchemaFactory.createForClass(PerformanceCompensationRecommendation);