This commit is contained in:
Marshal
2026-07-15 14:27:00 +00:00
parent 19c9da28ae
commit d7d9db9c3a
10 changed files with 554 additions and 25 deletions

View File

@@ -1,4 +1,5 @@
import {
BadRequestException,
Body, Controller, Delete, Get, HttpCode, HttpStatus,
Param, ParseUUIDPipe, Patch, Post, Query,
} from '@nestjs/common';
@@ -24,6 +25,23 @@ export class PriorityConfigsController {
return this.service.findAll(query);
}
// Static route — must stay above `:id` (Express matches in declaration order).
@Get('next-range')
@RuleEngineView('priority-configs')
@ApiOperation({
summary:
"Where the next contiguous range for a type (and currency) must start, plus the type's ceiling",
})
nextRange(
@Query('type') type: 'WAGON' | 'CURRENCY' | 'CUSTOMS',
@Query('currency') currency?: string,
) {
if (!['WAGON', 'CURRENCY', 'CUSTOMS'].includes(type)) {
throw new BadRequestException('type must be WAGON, CURRENCY, or CUSTOMS');
}
return this.service.nextRange(type, currency ?? null);
}
@Get(':id')
@RuleEngineView('priority-configs')
@ApiOperation({ summary: 'Get a priority config by ID' })