Archived
Reconcile: your admin wins, keeping main's non-admin work
You built a self-service catalogue admin on feature/admin-and-ui-wins while I built a
competing one that had already merged and deployed. Both forked from 27821cd. Per your
call, your implementation is the one that stays.
Kept from main (files your branch didn't touch, so no conflict):
- the CI test gate (tests now run and block the image)
- motion 12.42.2
- the platform contract test
Took from your branch:
- split AdminProductController / AdminCategoryController + ProductPhotoService (server-side
webp via cwebp)
- a real category table (Category, V3__categories.sql) behind the product filters
- pages/Admin.tsx, with server-side /admin protection that redirects a browser to Authentik
and returns it to /admin afterward — cleaner than my client-side gate, and it avoids the
post-login-to-home issue my version had
Deleted my competing admin (AdminController, MeController, pages/admin/*, auth.tsx, and my
admin tests).
Grafted onto your gallery: swipe + arrow keys, which the deployed version had and yours
didn't. Added an AdminSecurityTest for your endpoints (admin closed, shop public, contact
CSRF) — the admin was otherwise untested, and CI now gates on tests.
Verified against a running container: /admin redirects a browser to Authentik (a bare 401
only for */* fetches, which is correct). 25 tests green.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
-- The filter buttons were a hard-coded List.of(...) in ProductCatalog. That meant adding a category
|
||||
-- was a deploy, and anything an editor invented appeared last, alphabetically, with no way to move
|
||||
-- it. This makes the order data so the admin screens can arrange it.
|
||||
--
|
||||
-- product.category deliberately stays a varchar holding the name rather than becoming a foreign key:
|
||||
-- every existing row, query and derived repository method keeps working untouched, and six rows of
|
||||
-- reference data don't warrant rewriting the catalogue's shape. Renaming a category updates the
|
||||
-- products alongside it, in one transaction.
|
||||
create table category (
|
||||
id bigserial primary key,
|
||||
name varchar(60) not null unique,
|
||||
position integer not null,
|
||||
created_at timestamptz not null,
|
||||
updated_at timestamptz
|
||||
);
|
||||
|
||||
-- Seeded in the order the page has always shown them, so the site looks identical the moment this
|
||||
-- lands. Categories found on products but missing here still appear on the filter (appended
|
||||
-- alphabetically) rather than silently vanishing.
|
||||
insert into category (name, position, created_at) values
|
||||
('Cookies', 1, now()),
|
||||
('Cakes', 2, now()),
|
||||
('Rolls', 3, now()),
|
||||
('Pie', 4, now()),
|
||||
('Brownies', 5, now()),
|
||||
('Pastries', 6, now());
|
||||
Reference in New Issue
Block a user