mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 00:38:11 +00:00
fix transi permit file upload
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
IncidentType,
|
||||
} from './entities/clearance-incident.entity';
|
||||
import { ClearanceMilestoneService } from './clearance-milestone.service';
|
||||
import { persistExportTransportUploads } from './phased-clearance.util';
|
||||
|
||||
/**
|
||||
* Maps a GL post-booking document `code` to the milestone it auto-completes when
|
||||
@@ -165,7 +166,7 @@ export class GlOperationsService {
|
||||
*/
|
||||
async uploadTransportDocument(
|
||||
bookingId: string,
|
||||
file: Express.Multer.File,
|
||||
files: Express.Multer.File[],
|
||||
): Promise<{ uploaded: boolean; milestoneCompleted: boolean }> {
|
||||
const booking = await this.getBooking(bookingId);
|
||||
if (booking.tradeDirection !== 'EXPORT') {
|
||||
@@ -182,14 +183,11 @@ export class GlOperationsService {
|
||||
);
|
||||
}
|
||||
|
||||
if (!file) throw new BadRequestException('No transport document uploaded');
|
||||
if (files.length === 0) {
|
||||
throw new BadRequestException('No transit permit documents uploaded');
|
||||
}
|
||||
|
||||
await this.filesService.upsertByCode({
|
||||
resourceId: bookingId,
|
||||
resource: 'bookings',
|
||||
code: 'export_transport_document',
|
||||
file,
|
||||
});
|
||||
await persistExportTransportUploads(this.filesService, bookingId, files);
|
||||
|
||||
if (wagonAllocated && wagonAllocated.status !== 'COMPLETED') {
|
||||
await this.milestoneService.completeForBooking(bookingId, 'WAGON_ALLOCATED');
|
||||
|
||||
Reference in New Issue
Block a user