Some checks failed
CD Preprod / Unit Tests (${{ matrix.app }}) (backend) (push) Blocked by required conditions
CD Preprod / Unit Tests (${{ matrix.app }}) (frontend) (push) Blocked by required conditions
CD Preprod / Integration Tests (push) Blocked by required conditions
CD Preprod / Build & Push Backend (push) Blocked by required conditions
CD Preprod / Build & Push Frontend (push) Blocked by required conditions
CD Preprod / Deploy to Preprod (push) Blocked by required conditions
CD Preprod / Smoke Tests (push) Blocked by required conditions
CD Preprod / Deployment Summary (push) Blocked by required conditions
CD Preprod / Notify Success (push) Blocked by required conditions
CD Preprod / Notify Failure (push) Blocked by required conditions
CD Preprod / Quality (${{ matrix.app }}) (backend) (push) Has been cancelled
CD Preprod / Quality (${{ matrix.app }}) (frontend) (push) Has been cancelled
Aligns preprod with the complete application codebase (cicd branch). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
68 lines
1.7 KiB
TypeScript
68 lines
1.7 KiB
TypeScript
/**
|
|
* Admin CSV Rates API Client
|
|
*
|
|
* ADMIN-only endpoints for managing CSV rate files
|
|
*/
|
|
|
|
import { get, post, del, upload } from '../client';
|
|
import type {
|
|
CsvRateUploadResponse,
|
|
SuccessResponse,
|
|
} from '@/types/api';
|
|
|
|
// TODO: These types should be moved to @/types/api.ts
|
|
export interface CsvFileInfo {
|
|
filename: string;
|
|
size: number;
|
|
uploadedAt: string;
|
|
rowCount?: number;
|
|
companyEmail?: string | null;
|
|
}
|
|
|
|
export interface CsvFileListResponse {
|
|
files: CsvFileInfo[];
|
|
}
|
|
|
|
/**
|
|
* Upload CSV rate file (ADMIN only)
|
|
* POST /api/v1/admin/csv-rates/upload
|
|
*/
|
|
export async function uploadCsvRates(formData: FormData): Promise<CsvRateUploadResponse> {
|
|
return upload<CsvRateUploadResponse>('/api/v1/admin/csv-rates/upload', formData);
|
|
}
|
|
|
|
/**
|
|
* List all CSV files
|
|
* GET /api/v1/admin/csv-rates/files
|
|
*/
|
|
export async function listCsvFiles(): Promise<CsvFileListResponse> {
|
|
return get<CsvFileListResponse>('/api/v1/admin/csv-rates/files');
|
|
}
|
|
|
|
/**
|
|
* Delete CSV file
|
|
* DELETE /api/v1/admin/csv-rates/files/:filename
|
|
*/
|
|
export async function deleteCsvFile(filename: string): Promise<SuccessResponse> {
|
|
return del<SuccessResponse>(`/api/v1/admin/csv-rates/files/${encodeURIComponent(filename)}`);
|
|
}
|
|
|
|
/**
|
|
* Get CSV file statistics
|
|
* GET /api/v1/admin/csv-rates/stats/:filename
|
|
*/
|
|
export async function getCsvFileStats(filename: string): Promise<any> {
|
|
return get<any>(`/api/v1/admin/csv-rates/stats/${encodeURIComponent(filename)}`);
|
|
}
|
|
|
|
/**
|
|
* Convert CSV format (FOB FRET to Standard)
|
|
* POST /api/v1/admin/csv-rates/convert
|
|
*/
|
|
export async function convertCsvFormat(data: {
|
|
sourceFile: string;
|
|
targetFormat: 'STANDARD';
|
|
}): Promise<any> {
|
|
return post<any>('/api/v1/admin/csv-rates/convert', data);
|
|
}
|