mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 03:05:42 +00:00
Merge branch 'freight/hot_fix' of github.com:Tria-plc/edr-platform into freight/hot_fix
This commit is contained in:
@@ -32,6 +32,11 @@ export class CreateInvoices1821000000002 implements MigrationInterface {
|
|||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const invoicesExists = await queryRunner.query(
|
||||||
|
`SELECT 1 FROM information_schema.tables WHERE table_schema = 'freight' AND table_name = 'invoices';`,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!invoicesExists.length) {
|
||||||
await queryRunner.query(`
|
await queryRunner.query(`
|
||||||
CREATE TABLE freight.invoices (
|
CREATE TABLE freight.invoices (
|
||||||
id uuid NOT NULL DEFAULT uuid_generate_v4(),
|
id uuid NOT NULL DEFAULT uuid_generate_v4(),
|
||||||
@@ -73,7 +78,13 @@ export class CreateInvoices1821000000002 implements MigrationInterface {
|
|||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`CREATE INDEX idx_invoices_status ON freight.invoices (status);`,
|
`CREATE INDEX idx_invoices_status ON freight.invoices (status);`,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const invoiceLinesExists = await queryRunner.query(
|
||||||
|
`SELECT 1 FROM information_schema.tables WHERE table_schema = 'freight' AND table_name = 'invoice_lines';`,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!invoiceLinesExists.length) {
|
||||||
await queryRunner.query(`
|
await queryRunner.query(`
|
||||||
CREATE TABLE freight.invoice_lines (
|
CREATE TABLE freight.invoice_lines (
|
||||||
id uuid NOT NULL DEFAULT uuid_generate_v4(),
|
id uuid NOT NULL DEFAULT uuid_generate_v4(),
|
||||||
@@ -98,6 +109,7 @@ export class CreateInvoices1821000000002 implements MigrationInterface {
|
|||||||
`CREATE INDEX idx_invoice_lines_invoice ON freight.invoice_lines (invoice_id);`,
|
`CREATE INDEX idx_invoice_lines_invoice ON freight.invoice_lines (invoice_id);`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
await queryRunner.query(`DROP TABLE IF EXISTS freight.invoice_lines;`);
|
await queryRunner.query(`DROP TABLE IF EXISTS freight.invoice_lines;`);
|
||||||
|
|||||||
@@ -441,10 +441,10 @@ const FirstMilePage = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const allocateMutation = useMutation({
|
const allocateMutation = useMutation({
|
||||||
mutationFn: (data) => apiClient.post(`/first-mile/${containerAllocationFirstMileId}/allocate-containers`, data),
|
mutationFn: (data) => api.post(`/first-mile/${containerAllocationFirstMileId}/allocate-containers`, data),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast({ title: "Containers allocated" });
|
toast({ title: "Containers allocated" });
|
||||||
void qc.invalidateQueries({ queryKey: QUERY_KEYS.FIRST_MILE.detail(containerAllocationFirstMileId ?? "") });
|
void qc.invalidateQueries({ queryKey: QUERY_KEYS.FIRST_MILE.byId(containerAllocationFirstMileId ?? "") });
|
||||||
setContainerAllocationOpen(false);
|
setContainerAllocationOpen(false);
|
||||||
setContainerAllocationFirstMileId(null);
|
setContainerAllocationFirstMileId(null);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ const LastMilePage = () => {
|
|||||||
api.post(`/last-mile/${activeId}/allocate-containers`, data),
|
api.post(`/last-mile/${activeId}/allocate-containers`, data),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast({ title: "Containers allocated", variant: "default" });
|
toast({ title: "Containers allocated", variant: "default" });
|
||||||
void qc.invalidateQueries({ queryKey: QUERY_KEYS.LAST_MILE.detail(activeId ?? "") });
|
void qc.invalidateQueries({ queryKey: QUERY_KEYS.LAST_MILE.byId(activeId ?? "") });
|
||||||
closeAllocation();
|
closeAllocation();
|
||||||
},
|
},
|
||||||
onError: () => {
|
onError: () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user