mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
add permissions and fix issues
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||
import { CurrentUser } from '@edr/api-common';
|
||||
import type { TCurrentUser } from '@tria-plc/api-common/modules/auth/types/current-user.type';
|
||||
import { RuleEngineManage, RuleEngineView } from '../../../common/rule-engine-guards';
|
||||
import { RuleEngineCreate, RuleEngineDelete, RuleEngineUpdate, RuleEngineView } from '../../../common/rule-engine-guards';
|
||||
import { isSuperAdmin } from '../../../common/freight-permission.util';
|
||||
import { CreateRateDto } from '../dto/create-rate.dto';
|
||||
import { ListRatesQueryDto } from '../dto/list-rule-engine-query.dto';
|
||||
@@ -44,7 +44,7 @@ export class RatesController {
|
||||
}
|
||||
|
||||
@Post()
|
||||
@RuleEngineManage('rates')
|
||||
@RuleEngineCreate('rates')
|
||||
@ApiOperation({ summary: 'Create a rate (DRAFT)' })
|
||||
create(
|
||||
@Body() dto: CreateRateDto,
|
||||
@@ -54,21 +54,21 @@ export class RatesController {
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
@RuleEngineManage('rates')
|
||||
@RuleEngineUpdate('rates')
|
||||
@ApiOperation({ summary: 'Update a DRAFT rate' })
|
||||
update(@Param('id', ParseUUIDPipe) id: string, @Body() dto: UpdateRateDto) {
|
||||
return this.service.update(id, dto);
|
||||
}
|
||||
|
||||
@Post(':id/submit')
|
||||
@RuleEngineManage('rates')
|
||||
@RuleEngineUpdate('rates')
|
||||
@ApiOperation({ summary: 'Submit rate for CEO approval' })
|
||||
submit(@Param('id', ParseUUIDPipe) id: string) {
|
||||
return this.service.submitForApproval(id);
|
||||
}
|
||||
|
||||
@Post(':id/approve')
|
||||
@RuleEngineManage('rates')
|
||||
@RuleEngineUpdate('rates')
|
||||
@ApiOperation({ summary: 'CEO approves a rate' })
|
||||
approve(
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
@@ -80,7 +80,7 @@ export class RatesController {
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
@RuleEngineManage('rates')
|
||||
@RuleEngineDelete('rates')
|
||||
@HttpCode(HttpStatus.NO_CONTENT)
|
||||
@ApiOperation({ summary: 'Soft-delete a rate' })
|
||||
remove(@Param('id', ParseUUIDPipe) id: string) {
|
||||
|
||||
Reference in New Issue
Block a user