mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 13:05:44 +00:00
increase JSON body size limit, update awaiting shipment endpoint handling, and enhance contract document editor UI
This commit is contained in:
@@ -2,6 +2,7 @@ import "reflect-metadata";
|
|||||||
import * as dotenv from "dotenv";
|
import * as dotenv from "dotenv";
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
import { NestFactory } from "@nestjs/core";
|
import { NestFactory } from "@nestjs/core";
|
||||||
|
import { json, urlencoded } from "express";
|
||||||
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
|
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
|
||||||
import {
|
import {
|
||||||
HttpExceptionFilter,
|
HttpExceptionFilter,
|
||||||
@@ -11,9 +12,20 @@ import {
|
|||||||
|
|
||||||
import { AppModule } from "./app.module";
|
import { AppModule } from "./app.module";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON body ceiling. Signing posts the signature AND the company stamp as
|
||||||
|
* base64 in one JSON body, and base64 inflates bytes by ~4/3 — a 10MB stamp is
|
||||||
|
* ~13.4MB on the wire. Express defaults to 100kb, which rejected any real stamp
|
||||||
|
* image with a 413 "request entity too large".
|
||||||
|
*/
|
||||||
|
const JSON_BODY_LIMIT = '20mb';
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
|
|
||||||
|
app.use(json({ limit: JSON_BODY_LIMIT }));
|
||||||
|
app.use(urlencoded({ limit: JSON_BODY_LIMIT, extended: true }));
|
||||||
|
|
||||||
// Dev CORS: reflect any localhost origin and allow credentials so the
|
// Dev CORS: reflect any localhost origin and allow credentials so the
|
||||||
// freight portal (5173), passenger portal (5174), backoffices (5183/5184)
|
// freight portal (5173), passenger portal (5174), backoffices (5183/5184)
|
||||||
// and any other dev port can call the API with cookies + Authorization.
|
// and any other dev port can call the API with cookies + Authorization.
|
||||||
|
|||||||
@@ -276,6 +276,18 @@ export class ContractsController {
|
|||||||
return this.clearanceService.queue(filter);
|
return this.clearanceService.queue(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Must stay ABOVE @Get(':id') — declared after it, Nest matched the literal
|
||||||
|
// path as an id and ParseUUIDPipe answered 400 "uuid is expected".
|
||||||
|
@Get('awaiting-shipment')
|
||||||
|
@BookingStaff(FREIGHT_PERMS.contracts.createBooking)
|
||||||
|
@ApiOperation({
|
||||||
|
summary:
|
||||||
|
'GL worklist: executed one-time customs contracts with no shipment instance yet — GL initiates the booking the customer then uploads documents on.',
|
||||||
|
})
|
||||||
|
awaitingShipmentContracts() {
|
||||||
|
return this.contractBookingService.awaitingShipmentContracts();
|
||||||
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
@ApiOperation({ summary: 'Get contract by ID (routes, cargo scope, unit rates)' })
|
@ApiOperation({ summary: 'Get contract by ID (routes, cargo scope, unit rates)' })
|
||||||
async findOne(
|
async findOne(
|
||||||
@@ -986,16 +998,6 @@ export class ContractsController {
|
|||||||
return this.clearanceService.finalizeExportClearance(id, resolveAuthUserId(user));
|
return this.clearanceService.finalizeExportClearance(id, resolveAuthUserId(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('awaiting-shipment')
|
|
||||||
@BookingStaff(FREIGHT_PERMS.contracts.createBooking)
|
|
||||||
@ApiOperation({
|
|
||||||
summary:
|
|
||||||
'GL worklist: executed one-time customs contracts with no shipment instance yet — GL initiates the booking the customer then uploads documents on.',
|
|
||||||
})
|
|
||||||
awaitingShipmentContracts() {
|
|
||||||
return this.contractBookingService.awaitingShipmentContracts();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Path A self-clearance — Operations reviews the customer's own docs ───────
|
// ── Path A self-clearance — Operations reviews the customer's own docs ───────
|
||||||
|
|
||||||
@Post(':id/clearance/ops-review')
|
@Post(':id/clearance/ops-review')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useRef, useState } from "react";
|
|||||||
import { Box, Button, Group, Image, Paper, Stack, Text } from "@mantine/core";
|
import { Box, Button, Group, Image, Paper, Stack, Text } from "@mantine/core";
|
||||||
import { RefreshCw, Stamp, X } from "lucide-react";
|
import { RefreshCw, Stamp, X } from "lucide-react";
|
||||||
|
|
||||||
const MAX_STAMP_MB = 5;
|
const MAX_STAMP_MB = 10;
|
||||||
|
|
||||||
export interface StampUploadProps {
|
export interface StampUploadProps {
|
||||||
/** Stamp image as a data URL, or null when none is attached yet. */
|
/** Stamp image as a data URL, or null when none is attached yet. */
|
||||||
|
|||||||
Reference in New Issue
Block a user