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 | import { Controller, Get, Param, Request, UseGuards } from '@nestjs/common'; import { HierarchyService } from './hierarchy.service'; import { ApiTags, ApiBearerAuth, ApiOperation, ApiResponse, } from '@nestjs/swagger'; import { PermissionGuard } from '../../../platform/permissions/permission.guard'; import { RequirePermission } from '../../../platform/permissions/permission.decorator'; @ApiTags('HR - Hierarchy & Org Chart') @ApiBearerAuth() @UseGuards(PermissionGuard) @Controller('api/v1/hr') export class HierarchyController { constructor(private readonly hierarchyService: HierarchyService) {} @Get('employees/:id/manager-chain') @RequirePermission('hr.employee', 'read') @ApiOperation({ summary: 'Get manager chain operation' }) @ApiResponse({ status: 200, description: 'Operation successful' }) async getManagerChain(@Request() req: any, @Param('id') id: string) { return { success: true, data: await this.hierarchyService.getManagerChain(req.user.tenantId, id), }; } @Get('employees/:id/direct-reports') @RequirePermission('hr.employee', 'read') @ApiOperation({ summary: 'Get direct reports operation' }) @ApiResponse({ status: 200, description: 'Operation successful' }) async getDirectReports(@Request() req: any, @Param('id') id: string) { return { success: true, data: await this.hierarchyService.getDirectReports(req.user.tenantId, id), }; } @Get('organization-chart') @RequirePermission('hr.employee', 'read') @ApiOperation({ summary: 'Get org chart operation' }) @ApiResponse({ status: 200, description: 'Operation successful' }) async getOrgChart(@Request() req: any) { return { success: true, data: await this.hierarchyService.getFullOrgChart(req.user.tenantId), }; } @Get('organization-chart/:employeeId') @RequirePermission('hr.employee', 'read') @ApiOperation({ summary: 'Get org chart node operation' }) @ApiResponse({ status: 200, description: 'Operation successful' }) async getOrgChartNode( @Request() req: any, @Param('employeeId') employeeId: string, ) { return { success: true, data: await this.hierarchyService.getOrgChartNode( req.user.tenantId, employeeId, 3, ), }; } } |