Some checks failed
CI/CD Pipeline - Xpeditis PreProd / Frontend - Build & Test (push) Failing after 5m31s
CI/CD Pipeline - Xpeditis PreProd / Frontend - Docker Build & Push (push) Has been skipped
CI/CD Pipeline - Xpeditis PreProd / Backend - Build & Test (push) Failing after 5m42s
CI/CD Pipeline - Xpeditis PreProd / Backend - Docker Build & Push (push) Has been skipped
CI/CD Pipeline - Xpeditis PreProd / Deploy to PreProd Server (push) Has been skipped
CI/CD Pipeline - Xpeditis PreProd / Run Smoke Tests (push) Has been skipped
212 lines
4.3 KiB
TypeScript
212 lines
4.3 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { IsNotEmpty, IsString, MaxLength, IsEmail } from 'class-validator';
|
|
|
|
/**
|
|
* CSV Rate Upload DTO
|
|
*
|
|
* Request DTO for uploading CSV rate files (ADMIN only)
|
|
*/
|
|
export class CsvRateUploadDto {
|
|
@ApiProperty({
|
|
description: 'Name of the carrier company',
|
|
example: 'SSC Consolidation',
|
|
maxLength: 255,
|
|
})
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
@MaxLength(255)
|
|
companyName: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Email address of the carrier company for booking requests',
|
|
example: 'bookings@sscconsolidation.com',
|
|
maxLength: 255,
|
|
})
|
|
@IsNotEmpty()
|
|
@IsEmail()
|
|
@MaxLength(255)
|
|
companyEmail: string;
|
|
|
|
@ApiProperty({
|
|
description: 'CSV file containing shipping rates',
|
|
type: 'string',
|
|
format: 'binary',
|
|
})
|
|
file: any; // Will be handled by multer
|
|
}
|
|
|
|
/**
|
|
* CSV Rate Upload Response DTO
|
|
*/
|
|
export class CsvRateUploadResponseDto {
|
|
@ApiProperty({
|
|
description: 'Upload success status',
|
|
example: true,
|
|
})
|
|
success: boolean;
|
|
|
|
@ApiProperty({
|
|
description: 'Number of rate rows parsed from CSV',
|
|
example: 25,
|
|
})
|
|
ratesCount: number;
|
|
|
|
@ApiProperty({
|
|
description: 'Path where CSV file was saved',
|
|
example: 'ssc-consolidation.csv',
|
|
})
|
|
csvFilePath: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Company name for which rates were uploaded',
|
|
example: 'SSC Consolidation',
|
|
})
|
|
companyName: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Upload timestamp',
|
|
example: '2025-10-23T10:30:00Z',
|
|
})
|
|
uploadedAt: Date;
|
|
}
|
|
|
|
/**
|
|
* CSV Rate Config Response DTO
|
|
*
|
|
* Configuration entry for a company's CSV rates
|
|
*/
|
|
export class CsvRateConfigDto {
|
|
@ApiProperty({
|
|
description: 'Configuration ID',
|
|
example: '123e4567-e89b-12d3-a456-426614174000',
|
|
})
|
|
id: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Company name',
|
|
example: 'SSC Consolidation',
|
|
})
|
|
companyName: string;
|
|
|
|
@ApiProperty({
|
|
description: 'CSV file path',
|
|
example: 'ssc-consolidation.csv',
|
|
})
|
|
csvFilePath: string;
|
|
|
|
@ApiProperty({
|
|
description: 'Integration type',
|
|
enum: ['CSV_ONLY', 'CSV_AND_API'],
|
|
example: 'CSV_ONLY',
|
|
})
|
|
type: 'CSV_ONLY' | 'CSV_AND_API';
|
|
|
|
@ApiProperty({
|
|
description: 'Whether company has API connector',
|
|
example: false,
|
|
})
|
|
hasApi: boolean;
|
|
|
|
@ApiProperty({
|
|
description: 'API connector name if hasApi is true',
|
|
example: null,
|
|
nullable: true,
|
|
})
|
|
apiConnector: string | null;
|
|
|
|
@ApiProperty({
|
|
description: 'Whether configuration is active',
|
|
example: true,
|
|
})
|
|
isActive: boolean;
|
|
|
|
@ApiProperty({
|
|
description: 'When CSV was last uploaded',
|
|
example: '2025-10-23T10:30:00Z',
|
|
})
|
|
uploadedAt: Date;
|
|
|
|
@ApiProperty({
|
|
description: 'Number of rate rows in CSV',
|
|
example: 25,
|
|
nullable: true,
|
|
})
|
|
rowCount: number | null;
|
|
|
|
@ApiProperty({
|
|
description: 'Additional metadata',
|
|
example: { description: 'LCL rates for Europe to US', coverage: 'Global' },
|
|
nullable: true,
|
|
})
|
|
metadata: Record<string, any> | null;
|
|
}
|
|
|
|
/**
|
|
* CSV File Validation Result DTO
|
|
*/
|
|
export class CsvFileValidationDto {
|
|
@ApiProperty({
|
|
description: 'Whether CSV file is valid',
|
|
example: true,
|
|
})
|
|
valid: boolean;
|
|
|
|
@ApiProperty({
|
|
description: 'Validation errors if any',
|
|
type: [String],
|
|
example: [],
|
|
})
|
|
errors: string[];
|
|
|
|
@ApiProperty({
|
|
description: 'Number of rows in CSV file',
|
|
example: 25,
|
|
required: false,
|
|
})
|
|
rowCount?: number;
|
|
}
|
|
|
|
/**
|
|
* Available Companies Response DTO
|
|
*/
|
|
export class AvailableCompaniesDto {
|
|
@ApiProperty({
|
|
description: 'List of available company names',
|
|
type: [String],
|
|
example: ['SSC Consolidation', 'ECU Worldwide', 'TCC Logistics', 'NVO Consolidation'],
|
|
})
|
|
companies: string[];
|
|
|
|
@ApiProperty({
|
|
description: 'Total number of companies',
|
|
example: 4,
|
|
})
|
|
total: number;
|
|
}
|
|
|
|
/**
|
|
* Filter Options Response DTO
|
|
*/
|
|
export class FilterOptionsDto {
|
|
@ApiProperty({
|
|
description: 'Available company names',
|
|
type: [String],
|
|
example: ['SSC Consolidation', 'ECU Worldwide', 'TCC Logistics', 'NVO Consolidation'],
|
|
})
|
|
companies: string[];
|
|
|
|
@ApiProperty({
|
|
description: 'Available container types',
|
|
type: [String],
|
|
example: ['LCL', '20DRY', '40HC', '40DRY'],
|
|
})
|
|
containerTypes: string[];
|
|
|
|
@ApiProperty({
|
|
description: 'Supported currencies',
|
|
type: [String],
|
|
example: ['USD', 'EUR'],
|
|
})
|
|
currencies: string[];
|
|
}
|