add permission to print
This commit is contained in:
@@ -4,49 +4,50 @@ import { CreateSectionDto } from '../dto/create-section.dto';
|
||||
import { ApiBearerAuth, ApiOperation } from '@nestjs/swagger';
|
||||
import { AdminAuthGuard } from '../../auth/guards/adminAuth.guard';
|
||||
import { UpdateSectionDto } from '../dto/update-section.dto';
|
||||
import { Permissions } from 'src/common/decorators/permissions.decorator';
|
||||
import { Permission } from 'src/common/enums/permission.enum';
|
||||
|
||||
@Controller('admin')
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
export class PrintController {
|
||||
constructor(
|
||||
private readonly sectionService: PrintService,
|
||||
private readonly printService: PrintService,
|
||||
) { }
|
||||
|
||||
/*================================ Section ========================== */
|
||||
|
||||
@Post('section')
|
||||
@Permissions(Permission.MANAGE_PRINT)
|
||||
@ApiOperation({ summary: 'Create section' })
|
||||
@UseGuards(AdminAuthGuard)
|
||||
create(@Body() dto: CreateSectionDto) {
|
||||
return this.sectionService.create(dto);
|
||||
return this.printService.create(dto);
|
||||
}
|
||||
|
||||
@Get('section')
|
||||
@ApiOperation({ summary: 'find all section' })
|
||||
@UseGuards(AdminAuthGuard)
|
||||
findAll() {
|
||||
return this.sectionService.findAll();
|
||||
return this.printService.findAll();
|
||||
}
|
||||
|
||||
@Get('section/:id')
|
||||
@ApiOperation({ summary: 'Find one section' })
|
||||
@UseGuards(AdminAuthGuard)
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.sectionService.finOrFail(+id);
|
||||
return this.printService.finOrFail(+id);
|
||||
}
|
||||
|
||||
@Patch('section/:id')
|
||||
@Permissions(Permission.MANAGE_PRINT)
|
||||
@ApiOperation({ summary: 'Update section' })
|
||||
@UseGuards(AdminAuthGuard)
|
||||
update(@Param('id') id: string, @Body() dto: UpdateSectionDto) {
|
||||
return this.sectionService.update(+id, dto);
|
||||
return this.printService.update(+id, dto);
|
||||
}
|
||||
|
||||
@Delete('section/:id')
|
||||
@Permissions(Permission.MANAGE_PRINT)
|
||||
@ApiOperation({ summary: 'Remove section' })
|
||||
@UseGuards(AdminAuthGuard)
|
||||
remove(@Param('id') id: string) {
|
||||
return this.sectionService.remove(+id);
|
||||
return this.printService.remove(+id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user