mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 08:48:11 +00:00
feat: ( permissions ) add permssions for master data
This commit is contained in:
@@ -3,7 +3,8 @@ import { ApiTags, ApiOperation, ApiBearerAuth, ApiParam, ApiQuery, ApiBody, ApiR
|
||||
import { FleetService } from './fleet.service';
|
||||
import { CreateTrainDto, CreateCoachDto, UpdateCoachDto, AssignCoachDto, ListCoachesDto, CreateCoachTypeDto, UpdateCoachTypeDto, CreateClassDto, UpdateClassDto, GenerateSeatMapDto } from './fleet.dto';
|
||||
import { JwtGuard } from '../../common/jwt.guard';
|
||||
import { PassengerAdmin } from '../../common/passenger-guards';
|
||||
import { PassengerAdmin, PassengerStaff } from '../../common/passenger-guards';
|
||||
import { PASSENGER_PERMS } from '../../seed/passenger-permissions.registry';
|
||||
|
||||
@ApiTags('Fleet')
|
||||
@Controller('fleet')
|
||||
@@ -21,6 +22,7 @@ export class FleetController {
|
||||
}
|
||||
|
||||
@Post('coach-types')
|
||||
@PassengerStaff([PASSENGER_PERMS.coaches.manage, PASSENGER_PERMS.admin])
|
||||
@ApiOperation({ summary: 'Create a coach type' })
|
||||
@ApiBody({ type: CreateCoachTypeDto })
|
||||
@ApiResponse({ status: 201, description: 'Coach type created' })
|
||||
@@ -29,6 +31,7 @@ export class FleetController {
|
||||
}
|
||||
|
||||
@Patch('coach-types/:id')
|
||||
@PassengerStaff([PASSENGER_PERMS.coaches.manage, PASSENGER_PERMS.admin])
|
||||
@ApiOperation({ summary: 'Update a coach type' })
|
||||
@ApiParam({ name: 'id', description: 'Coach Type UUID' })
|
||||
@ApiBody({ type: UpdateCoachTypeDto })
|
||||
@@ -59,6 +62,7 @@ export class FleetController {
|
||||
}
|
||||
|
||||
@Post('classes')
|
||||
@PassengerStaff([PASSENGER_PERMS.classes.manage, PASSENGER_PERMS.admin])
|
||||
@ApiOperation({ summary: 'Create a class' })
|
||||
@ApiBody({ type: CreateClassDto })
|
||||
@ApiResponse({ status: 201, description: 'Class created' })
|
||||
@@ -67,6 +71,7 @@ export class FleetController {
|
||||
}
|
||||
|
||||
@Patch('classes/:id')
|
||||
@PassengerStaff([PASSENGER_PERMS.classes.manage, PASSENGER_PERMS.admin])
|
||||
@ApiOperation({ summary: 'Update a class' })
|
||||
@ApiParam({ name: 'id', description: 'Class UUID' })
|
||||
@ApiBody({ type: UpdateClassDto })
|
||||
@@ -98,6 +103,7 @@ export class FleetController {
|
||||
}
|
||||
|
||||
@Post('seat-classes')
|
||||
@PassengerStaff([PASSENGER_PERMS.classes.manage, PASSENGER_PERMS.admin])
|
||||
@ApiOperation({ summary: 'Create a class (DEPRECATED - use /fleet/classes)' })
|
||||
@ApiBody({ type: CreateClassDto })
|
||||
@ApiResponse({ status: 201, description: 'Class created' })
|
||||
@@ -106,6 +112,7 @@ export class FleetController {
|
||||
}
|
||||
|
||||
@Patch('seat-classes/:id')
|
||||
@PassengerStaff([PASSENGER_PERMS.classes.manage, PASSENGER_PERMS.admin])
|
||||
@ApiOperation({ summary: 'Update a class (DEPRECATED - use /fleet/classes)' })
|
||||
@ApiParam({ name: 'id', description: 'Class UUID' })
|
||||
@ApiBody({ type: UpdateClassDto })
|
||||
@@ -136,6 +143,7 @@ export class FleetController {
|
||||
}
|
||||
|
||||
@Post('trains')
|
||||
@PassengerStaff([PASSENGER_PERMS.trains.manage, PASSENGER_PERMS.admin])
|
||||
@ApiOperation({ summary: 'Create a train service' })
|
||||
@ApiBody({ type: CreateTrainDto })
|
||||
@ApiResponse({ status: 201, description: 'Train created' })
|
||||
@@ -144,6 +152,7 @@ export class FleetController {
|
||||
}
|
||||
|
||||
@Patch('trains/:id')
|
||||
@PassengerStaff([PASSENGER_PERMS.trains.manage, PASSENGER_PERMS.admin])
|
||||
@ApiOperation({ summary: 'Update a train service' })
|
||||
@ApiParam({ name: 'id', description: 'Train UUID' })
|
||||
@ApiBody({ type: CreateTrainDto })
|
||||
@@ -166,6 +175,7 @@ export class FleetController {
|
||||
}
|
||||
|
||||
@Patch('trains/:id/restore')
|
||||
@PassengerStaff([PASSENGER_PERMS.trains.manage, PASSENGER_PERMS.admin])
|
||||
@ApiOperation({ summary: 'Restore (reactivate) a deactivated train' })
|
||||
@ApiParam({ name: 'id', description: 'Train UUID' })
|
||||
@ApiResponse({ status: 200, description: 'Train restored' })
|
||||
@@ -268,6 +278,7 @@ export class FleetController {
|
||||
}
|
||||
|
||||
@Post('coaches')
|
||||
@PassengerStaff([PASSENGER_PERMS.coaches.manage, PASSENGER_PERMS.admin])
|
||||
@ApiOperation({ summary: 'Create a coach with auto-generated seat numbers' })
|
||||
@ApiBody({ type: CreateCoachDto })
|
||||
@ApiResponse({
|
||||
@@ -293,6 +304,7 @@ export class FleetController {
|
||||
}
|
||||
|
||||
@Patch('coaches/:id')
|
||||
@PassengerStaff([PASSENGER_PERMS.coaches.manage, PASSENGER_PERMS.admin])
|
||||
@ApiOperation({ summary: 'Update coach properties' })
|
||||
@ApiParam({ name: 'id', description: 'Coach UUID' })
|
||||
@ApiBody({ type: UpdateCoachDto })
|
||||
@@ -331,6 +343,7 @@ export class FleetController {
|
||||
}
|
||||
|
||||
@Post('assignments')
|
||||
@PassengerStaff([PASSENGER_PERMS.coaches.manage, PASSENGER_PERMS.admin])
|
||||
@ApiOperation({ summary: 'Assign a coach to a schedule' })
|
||||
@ApiBody({ type: AssignCoachDto })
|
||||
@ApiResponse({ status: 201, description: 'Coach assigned' })
|
||||
|
||||
Reference in New Issue
Block a user