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 | import { Controller, Get, Put, Body, Request, UseGuards } from '@nestjs/common'; import { EmployeeNumberingService } from './numbering.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 - Employee Numbering') @ApiBearerAuth() @UseGuards(PermissionGuard) @Controller('api/v1/hr/employee-numbering') export class NumberingController { constructor(private readonly numberingService: EmployeeNumberingService) {} @Get() @RequirePermission('hr.employee', 'read') @ApiOperation({ summary: 'Get rule operation' }) @ApiResponse({ status: 200, description: 'Operation successful' }) async getRule(@Request() req: any) { return { success: true, data: await this.numberingService.getRule(req.user.tenantId), }; } @Put() @RequirePermission('hr.employee', 'update') @ApiOperation({ summary: 'Update rule operation' }) @ApiResponse({ status: 200, description: 'Operation successful' }) async updateRule(@Request() req: any, @Body() body: any) { return { success: true, data: await this.numberingService.updateRule(req.user.tenantId, body), }; } @Get('preview') @RequirePermission('hr.employee', 'read') @ApiOperation({ summary: 'Preview operation' }) @ApiResponse({ status: 200, description: 'Operation successful' }) async preview(@Request() req: any) { const preview = await this.numberingService.generateNextNumber( req.user.tenantId, ); return { success: true, data: { preview } }; } } |