mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 09:00:57 +00:00
24 lines
779 B
TypeScript
24 lines
779 B
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);
|