mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 20:10:56 +00:00
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
import { applyDecorators, UseGuards } from '@nestjs/common';
|
|
import { JwtGuard } from '@tria-plc/api-common/modules/auth/services/jwt.guard';
|
|
|
|
import { FreightPermissionGuard } from './freight-permission.guard';
|
|
import { FREIGHT_PERMS } from '../seed/freight-permissions.registry';
|
|
|
|
export const BookingStaff = (permission: string | string[]) =>
|
|
applyDecorators(
|
|
UseGuards(
|
|
JwtGuard,
|
|
FreightPermissionGuard(
|
|
Array.isArray(permission) ? permission : [permission],
|
|
),
|
|
),
|
|
);
|
|
|
|
export const BookingView = () => BookingStaff(FREIGHT_PERMS.bookings.view);
|
|
|
|
export const TrainSchedulingView = () =>
|
|
BookingStaff(FREIGHT_PERMS.trainScheduling.view);
|
|
|
|
export const TrainSchedulingManage = () =>
|
|
BookingStaff(FREIGHT_PERMS.trainScheduling.manage);
|
|
|
|
export const FleetView = () => BookingStaff(FREIGHT_PERMS.fleet.view);
|
|
|
|
export const FleetManage = () => BookingStaff(FREIGHT_PERMS.fleet.manage);
|
|
|
|
/** Requester creates a wagon-transfer request (count-only, no wagon picks). */
|
|
export const WagonTransferRequest = () =>
|
|
BookingStaff(FREIGHT_PERMS.wagons.transferRequest);
|
|
|
|
/** OCC fulfils a wagon-transfer request — picks the wagons and executes the move. */
|
|
export const WagonTransferFulfill = () =>
|
|
BookingStaff(FREIGHT_PERMS.wagons.transferFulfill);
|
|
|
|
/** Org-administration endpoints (user mgmt, billing config, company CRUD, settings). */
|
|
export const FreightAdmin = () => BookingStaff(FREIGHT_PERMS.admin);
|
|
|
|
/** Container allocation on a booking (allocate-containers endpoint). */
|
|
export const AllocationManage = () =>
|
|
BookingStaff(FREIGHT_PERMS.allocation.manage);
|