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 | import { Controller, Get, Post, Body, Put, Param, UseGuards, Request, } from '@nestjs/common'; import { WorkWeekService } from './work-week.service'; import { CreateWorkWeekDto, UpdateWorkWeekDto, CreateWorkWeekDayRuleDto, AssignWorkWeekDto, } from './dto/work-week.dto'; import { PermissionGuard } from '../../../../platform/permissions/permission.guard'; import { RequirePermission } from '../../../../platform/permissions/permission.decorator'; import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger'; @Controller('work-weeks') @UseGuards(PermissionGuard) @ApiTags('WorkWeek') export class WorkWeekController { constructor(private readonly workWeekService: WorkWeekService) {} @Post() @RequirePermission('work_week', 'create') @ApiOperation({ summary: 'Create operation' }) @ApiResponse({ status: 201, description: 'Operation successful' }) create(@Request() req: any, @Body() createDto: CreateWorkWeekDto) { return this.workWeekService.create( req.user.tenantId, createDto, req.user.userId, ); } @Get() @RequirePermission('work_week', 'read') @ApiOperation({ summary: 'Find all operation' }) @ApiResponse({ status: 200, description: 'Operation successful' }) findAll(@Request() req: any) { return this.workWeekService.findAll(req.user.tenantId); } @Get(':id') @RequirePermission('work_week', 'read') @ApiOperation({ summary: 'Find one operation' }) @ApiResponse({ status: 200, description: 'Operation successful' }) findOne(@Request() req: any, @Param('id') id: string) { return this.workWeekService.findOne(req.user.tenantId, id); } @Put(':id') @RequirePermission('work_week', 'update') @ApiOperation({ summary: 'Update operation' }) @ApiResponse({ status: 200, description: 'Operation successful' }) update( @Request() req: any, @Param('id') id: string, @Body() updateDto: UpdateWorkWeekDto, ) { return this.workWeekService.update(req.user.tenantId, id, updateDto); } @Post(':id/day-rules') @RequirePermission('work_week', 'update') @ApiOperation({ summary: 'Set day rules operation' }) @ApiResponse({ status: 201, description: 'Operation successful' }) setDayRules( @Request() req: any, @Param('id') id: string, @Body() rulesDto: CreateWorkWeekDayRuleDto[], ) { return this.workWeekService.setDayRules(req.user.tenantId, id, rulesDto); } @Get(':id/day-rules') @RequirePermission('work_week', 'read') @ApiOperation({ summary: 'Get day rules operation' }) @ApiResponse({ status: 200, description: 'Operation successful' }) getDayRules(@Request() req: any, @Param('id') id: string) { return this.workWeekService.getDayRules(req.user.tenantId, id); } @Post(':id/assign') @RequirePermission('work_week', 'update') @ApiOperation({ summary: 'Assign work week operation' }) @ApiResponse({ status: 201, description: 'Operation successful' }) assignWorkWeek( @Request() req: any, @Param('id') id: string, @Body() assignDto: AssignWorkWeekDto, ) { return this.workWeekService.assignWorkWeek( req.user.tenantId, id, assignDto, ); } } |