fix(admin): issue #147 — Catalog Tree city edit/delete, sort order, subcategory ops
- handleRename: city rename via /api/locations/rename-city (all rows), district via PUT /api/locations/{id}
- City-level delete: DELETE /api/locations/by-city (blocks on dependencies, 400 with counts)
- Sort order: idempotent ensureSortOrderColumns (ALTER TABLE try/catch) + PATCH /api/{type}s/{id}/sort + up/down arrows on district/category/subcategory
- Tree queries order by sort_order asc, then name
- Subcategory rename/delete verified
- tsc clean
This commit is contained in:
@@ -68,6 +68,7 @@ model Location {
|
||||
country String
|
||||
city String
|
||||
district String @default("")
|
||||
sortOrder Int @default(0) @map("sort_order")
|
||||
isActive Int @default(1) @map("is_active")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@ -82,6 +83,7 @@ model Category {
|
||||
id Int @id @default(autoincrement())
|
||||
locationId Int @map("location_id")
|
||||
name String
|
||||
sortOrder Int @default(0) @map("sort_order")
|
||||
isActive Int @default(1) @map("is_active")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@ -97,6 +99,7 @@ model Subcategory {
|
||||
id Int @id @default(autoincrement())
|
||||
categoryId Int @map("category_id")
|
||||
name String
|
||||
sortOrder Int @default(0) @map("sort_order")
|
||||
isActive Int @default(1) @map("is_active")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user