mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 21:08:12 +00:00
per-user trade-direction access scope
This commit is contained in:
@@ -59,14 +59,23 @@ export class YardFacilitiesSeeder {
|
||||
[yard.id],
|
||||
);
|
||||
|
||||
// Every facility works both sides of the trip today, so the per-side
|
||||
// flags mirror the freight-type flags. Narrow an individual yard here
|
||||
// when a real one turns out to load a type but not receive it.
|
||||
await this.dataSource.query(
|
||||
`INSERT INTO freight.yard_facilities
|
||||
(yard_id, has_warehouse, handles_container, handles_bulk, equipment_notes)
|
||||
VALUES ($1, $2, $3, true, $4)
|
||||
(yard_id, has_warehouse, handles_container, handles_bulk, equipment_notes,
|
||||
has_container_facility_origin, has_container_facility_destination,
|
||||
has_bulk_facility_origin, has_bulk_facility_destination)
|
||||
VALUES ($1, $2, $3, true, $4, $3, $3, true, true)
|
||||
ON CONFLICT (yard_id) WHERE deleted_at IS NULL
|
||||
DO UPDATE SET has_warehouse = EXCLUDED.has_warehouse,
|
||||
handles_container = EXCLUDED.handles_container,
|
||||
handles_bulk = EXCLUDED.handles_bulk,
|
||||
has_container_facility_origin = EXCLUDED.has_container_facility_origin,
|
||||
has_container_facility_destination = EXCLUDED.has_container_facility_destination,
|
||||
has_bulk_facility_origin = EXCLUDED.has_bulk_facility_origin,
|
||||
has_bulk_facility_destination = EXCLUDED.has_bulk_facility_destination,
|
||||
updated_at = NOW()`,
|
||||
[yard.id, hasWarehouse, handlesContainer, `${facility} load/unload facility`],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user