add permission to print
This commit is contained in:
@@ -22,8 +22,9 @@ export enum Permission {
|
|||||||
|
|
||||||
MANAGE_SETTINGS = 'manage_settings',
|
MANAGE_SETTINGS = 'manage_settings',
|
||||||
|
|
||||||
|
MANAGE_FORM_BUILDER = 'manage_form_builder',
|
||||||
|
|
||||||
MANAGE_FORM_BUILDER='manage_form_builder'
|
MANAGE_PRINT = 'manage_print'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,5 +48,6 @@ export const PermissionTitles: Record<Permission, string> = {
|
|||||||
[Permission.MANAGE_ROLES]: 'مدیریت نقشها',
|
[Permission.MANAGE_ROLES]: 'مدیریت نقشها',
|
||||||
[Permission.MANAGE_PAYMENTS]: 'مدیریت پرداختها',
|
[Permission.MANAGE_PAYMENTS]: 'مدیریت پرداختها',
|
||||||
[Permission.MANAGE_SETTINGS]: 'مدیریت تنظیمات',
|
[Permission.MANAGE_SETTINGS]: 'مدیریت تنظیمات',
|
||||||
[Permission.MANAGE_FORM_BUILDER]: "مدیریت فرم بیلدر"
|
[Permission.MANAGE_FORM_BUILDER]: "مدیریت فرم بیلدر",
|
||||||
|
[Permission.MANAGE_PRINT]: 'مدیریت فرم پرینت'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,49 +4,50 @@ import { CreateSectionDto } from '../dto/create-section.dto';
|
|||||||
import { ApiBearerAuth, ApiOperation } from '@nestjs/swagger';
|
import { ApiBearerAuth, ApiOperation } from '@nestjs/swagger';
|
||||||
import { AdminAuthGuard } from '../../auth/guards/adminAuth.guard';
|
import { AdminAuthGuard } from '../../auth/guards/adminAuth.guard';
|
||||||
import { UpdateSectionDto } from '../dto/update-section.dto';
|
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')
|
@Controller('admin')
|
||||||
|
@UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
export class PrintController {
|
export class PrintController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly sectionService: PrintService,
|
private readonly printService: PrintService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
/*================================ Section ========================== */
|
/*================================ Section ========================== */
|
||||||
|
|
||||||
@Post('section')
|
@Post('section')
|
||||||
|
@Permissions(Permission.MANAGE_PRINT)
|
||||||
@ApiOperation({ summary: 'Create section' })
|
@ApiOperation({ summary: 'Create section' })
|
||||||
@UseGuards(AdminAuthGuard)
|
|
||||||
create(@Body() dto: CreateSectionDto) {
|
create(@Body() dto: CreateSectionDto) {
|
||||||
return this.sectionService.create(dto);
|
return this.printService.create(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('section')
|
@Get('section')
|
||||||
@ApiOperation({ summary: 'find all section' })
|
@ApiOperation({ summary: 'find all section' })
|
||||||
@UseGuards(AdminAuthGuard)
|
|
||||||
findAll() {
|
findAll() {
|
||||||
return this.sectionService.findAll();
|
return this.printService.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('section/:id')
|
@Get('section/:id')
|
||||||
@ApiOperation({ summary: 'Find one section' })
|
@ApiOperation({ summary: 'Find one section' })
|
||||||
@UseGuards(AdminAuthGuard)
|
|
||||||
findOne(@Param('id') id: string) {
|
findOne(@Param('id') id: string) {
|
||||||
return this.sectionService.finOrFail(+id);
|
return this.printService.finOrFail(+id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch('section/:id')
|
@Patch('section/:id')
|
||||||
|
@Permissions(Permission.MANAGE_PRINT)
|
||||||
@ApiOperation({ summary: 'Update section' })
|
@ApiOperation({ summary: 'Update section' })
|
||||||
@UseGuards(AdminAuthGuard)
|
|
||||||
update(@Param('id') id: string, @Body() dto: UpdateSectionDto) {
|
update(@Param('id') id: string, @Body() dto: UpdateSectionDto) {
|
||||||
return this.sectionService.update(+id, dto);
|
return this.printService.update(+id, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete('section/:id')
|
@Delete('section/:id')
|
||||||
|
@Permissions(Permission.MANAGE_PRINT)
|
||||||
@ApiOperation({ summary: 'Remove section' })
|
@ApiOperation({ summary: 'Remove section' })
|
||||||
@UseGuards(AdminAuthGuard)
|
|
||||||
remove(@Param('id') id: string) {
|
remove(@Param('id') id: string) {
|
||||||
return this.sectionService.remove(+id);
|
return this.printService.remove(+id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user