From 6fb8adc2562cd1b85375e502bab765a87a3fc12f Mon Sep 17 00:00:00 2001 From: cproudlock Date: Fri, 26 Jun 2026 12:09:05 -0400 Subject: [PATCH] Add locationtypes + location tree (ADR-001) - New locationtypes lookup (LocationType model) seeded with section, cell, subcell, operation, meetingroom, lab, office, storage, hallway, networkcloset, building. - locations gains locationtypeid + parentlocationid (self-FK) for the site location tree. Migration 7c03; cli reference-data seeds the types. - GET /api/locations/types; locations CRUD accepts type + parent; list/detail return locationtypename + parentlocationname. - Locations settings page: Type column + Type/Parent selectors in the modal. Realizes the operation-as-Location model (operations are locations with locationtypeid='operation'). Co-Authored-By: Claude Opus 4.8 --- frontend/src/api/index.js | 5 ++ frontend/src/views/settings/LocationsList.vue | 66 +++++++++++++++++-- migrations/versions/7c03_locationtypes.py | 56 ++++++++++++++++ shopdb/cli/__init__.py | 10 ++- shopdb/core/api/locations.py | 21 +++++- shopdb/core/models/__init__.py | 3 +- shopdb/core/models/location.py | 41 +++++++++++- 7 files changed, 192 insertions(+), 10 deletions(-) create mode 100644 migrations/versions/7c03_locationtypes.py diff --git a/frontend/src/api/index.js b/frontend/src/api/index.js index 78ea2d5..b5827ab 100644 --- a/frontend/src/api/index.js +++ b/frontend/src/api/index.js @@ -202,6 +202,11 @@ export const locationsApi = { }, delete(id) { return api.delete(`/locations/${id}`) + }, + types: { + list() { + return api.get('/locations/types') + } } } diff --git a/frontend/src/views/settings/LocationsList.vue b/frontend/src/views/settings/LocationsList.vue index 1d57c5e..0f55f45 100644 --- a/frontend/src/views/settings/LocationsList.vue +++ b/frontend/src/views/settings/LocationsList.vue @@ -25,6 +25,7 @@ Location Name + Type Building Floor Room @@ -35,6 +36,7 @@ {{ loc.locationname }} + {{ loc.locationtypename || '-' }} {{ loc.building || '-' }} {{ loc.floor || '-' }} {{ loc.room || '-' }} @@ -55,7 +57,7 @@ - + No locations found @@ -125,6 +127,32 @@ +
+
+ + +
+ +
+ + +
+
+