All files / src/domains/performance performance.controller.ts

0% Statements 0/29
0% Branches 0/8
0% Functions 0/10
0% Lines 0/25

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                                                                                                                                                                                                   
import { Controller, Get, Post, Body, Param, Query, Patch, Delete } from '@nestjs/common';
import { PerformanceService } from './performance.service';
import { Types } from 'mongoose';
 
@Controller('api/v1/performance')
export class PerformanceController {
  constructor(private readonly service: PerformanceService) {}
 
  // ----------------------------------------------------
  // Configuration & Calibration Endpoints
  // ----------------------------------------------------
  @Get('calibration/deviation')
  async getDeviation(
    @Query('tenantId') tenantId: string,
    @Query('cycleId') cycleId: string
  ) {
    return this.service.getBellCurveDeviation(tenantId, cycleId);
  }
 
  @Post('talent/matrix')
  async assignTalentMatrix(
    @Body('tenantId') tenantId: string,
    @Body('cycleId') cycleId: string,
    @Body('employeeId') employeeId: string,
    @Body('performance') performance: string,
    @Body('potential') potential: string
  ) {
    return this.service.assignEmployeeToTalentMatrix(tenantId, cycleId, employeeId, performance, potential);
  }
 
  // ----------------------------------------------------
  // OKRs & Goals Calculations
  // ----------------------------------------------------
  @Post('okr/:objectiveId/calculate')
  async calculateOkr(
    @Param('objectiveId') objectiveId: string,
    @Body('tenantId') tenantId: string
  ) {
    const progress = await this.service.calculateOkrProgress(tenantId, objectiveId);
    return { success: true, progress };
  }
 
  @Post('goal/:goalId/cascade')
  async cascadeGoal(
    @Param('goalId') goalId: string,
    @Body('tenantId') tenantId: string
  ) {
    const progress = await this.service.cascadeGoalProgress(tenantId, goalId);
    return { success: true, progress };
  }
 
  @Post('kpi/:measurementId/calculate')
  async calculateKpi(
    @Param('measurementId') measurementId: string,
    @Body('tenantId') tenantId: string
  ) {
    const score = await this.service.calculateKpiAchievement(tenantId, measurementId);
    return { success: true, achievementScore: score };
  }
 
  // ----------------------------------------------------
  // Skills Matrix Gap Analysis
  // ----------------------------------------------------
  @Get('employee/:employeeId/skills-gap')
  async getSkillsGap(
    @Param('employeeId') employeeId: string,
    @Query('tenantId') tenantId: string
  ) {
    return this.service.getEmployeeSkillGapReport(tenantId, employeeId);
  }
}
 
@Controller('api/v1/mobile/performance')
export class MobilePerformanceController {
  constructor(private readonly service: PerformanceService) {}
 
  @Get('dashboard')
  async getMobileDashboard(
    @Query('tenantId') tenantId: string,
    @Query('employeeId') employeeId: string
  ) {
    return {
      activeCycle: 'FY 2026 Appraisal Cycle',
      goalsCount: 4,
      pendingSelfAppraisals: 1,
      skillsGapAlerts: 0
    };
  }
 
  @Get('employee/:employeeId/skills-gap')
  async getMobileSkillsGap(
    @Param('employeeId') employeeId: string,
    @Query('tenantId') tenantId: string
  ) {
    return this.service.getEmployeeSkillGapReport(tenantId, employeeId);
  }
}