mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
11 lines
374 B
TypeScript
11 lines
374 B
TypeScript
import { ConflictException } from '@nestjs/common';
|
|
import { Booking } from './entities/booking.entity';
|
|
|
|
export function assertBookingStatus(booking: Booking, allowed: string[]): void {
|
|
if (!allowed.includes(booking.status)) {
|
|
throw new ConflictException(
|
|
`Cannot perform this action on status "${booking.status}". Allowed: ${allowed.join(', ')}`,
|
|
);
|
|
}
|
|
}
|