Edit and delete brands and shops
Build and push image / build (push) Successful in 49s

Adds PATCH and DELETE endpoints for brands and shops that mirror the
existing bins pattern: deleting a brand or shop nullifies referencing
products (and strains, for brands) inside a transaction so nothing is
lost. Brand renames return 409 when the new name collides with the
UNIQUE constraint, surfaced inline in the edit modal.

The Brands and Shops views now show inline edit/trash icons on each
card; the trash button confirms with a preview of how many products
will be unparented.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-03 21:33:42 -04:00
parent d00eb4c12b
commit 8ef8859c7d
6 changed files with 365 additions and 9 deletions
+18
View File
@@ -61,12 +61,30 @@ export const api = {
body: JSON.stringify({ name }),
}),
updateBrand: (id: string, body: { name: string }) =>
request<{ id: string; name: string }>(`/brands/${id}`, {
method: "PATCH",
body: JSON.stringify(body),
}),
deleteBrand: (id: string) =>
request<{ ok: true }>(`/brands/${id}`, { method: "DELETE" }),
createShop: (body: { name: string; location?: string }) =>
request<{ id: string; name: string; location: string | null }>("/shops", {
method: "POST",
body: JSON.stringify(body),
}),
updateShop: (id: string, body: { name?: string; location?: string | null }) =>
request<{ id: string; name: string; location: string | null }>(`/shops/${id}`, {
method: "PATCH",
body: JSON.stringify(body),
}),
deleteShop: (id: string) =>
request<{ ok: true }>(`/shops/${id}`, { method: "DELETE" }),
createBin: (body: { name: string; location?: string; capacity?: number }) =>
request<{ id: string; name: string; location: string | null; capacity: number }>("/bins", {
method: "POST",