mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 21:48:18 +00:00
feat(warehouses): allow deleting a warehouse
Soft-delete route guarded by warehouses:delete, refused with 409 while yards remain — zones and inventory hang off a yard, so cascading would orphan stock. Backoffice list gets a delete action in both views, omitted when the user lacks the permission.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
/**
|
||||
* Backlog registration of full containers that were already sitting in a yard
|
||||
* before the system knew about them. Such a row carries a true, backdated
|
||||
* `arrived_at` for the record but accrues NO storage or demurrage — the
|
||||
* operator decided these are not billable retroactively — so the flag exists
|
||||
* to keep the fee engine off them.
|
||||
*
|
||||
* `company_id` / `company_name` carry the owner, since a backlog row has no
|
||||
* booking to inherit one from. The name is free text for a company that is not
|
||||
* a registered customer yet.
|
||||
*/
|
||||
export class WarehouseInventoryBacklogRegistration3800000000000 implements MigrationInterface {
|
||||
name = 'WarehouseInventoryBacklogRegistration3800000000000';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE freight.warehouse_inventory
|
||||
ADD COLUMN IF NOT EXISTS backlog_registration boolean NOT NULL DEFAULT false,
|
||||
ADD COLUMN IF NOT EXISTS company_id uuid,
|
||||
ADD COLUMN IF NOT EXISTS company_name varchar(200)
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE freight.warehouse_inventory
|
||||
DROP COLUMN IF EXISTS backlog_registration,
|
||||
DROP COLUMN IF EXISTS company_id,
|
||||
DROP COLUMN IF EXISTS company_name
|
||||
`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user