feat(content+admin): home-events CRUD + comments moderation
Build backend images / build content-svc (push) Failing after 45s
Build backend images / build file-svc (push) Failing after 1m3s
Build backend images / build gateway (push) Failing after 0s
Build backend images / build identity-svc (push) Failing after 0s
Build backend images / build notification-svc (push) Failing after 1s
Build backend images / build render-svc (push) Failing after 1s
Build backend images / build studio-svc (push) Failing after 0s
Build backend images / build content-svc (push) Failing after 45s
Build backend images / build file-svc (push) Failing after 1m3s
Build backend images / build gateway (push) Failing after 0s
Build backend images / build identity-svc (push) Failing after 0s
Build backend images / build notification-svc (push) Failing after 1s
Build backend images / build render-svc (push) Failing after 1s
Build backend images / build studio-svc (push) Failing after 0s
- content-svc: home-events gains Create/Update/Delete + includeInactive list (POST/PUT/DELETE /v1/home-events, admin-gated; dates coerced to UTC) - admin /admin/home-events: full CRUD for homepage hero event banners - admin /admin/comments: list + approve/unapprove + delete (moderation) - AdminResource: optional listQuery to fetch inactive rows for admin views Fills the remaining legacy-admin gaps (home events, comments). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ export interface ResourceConfig {
|
||||
basePath: string; // e.g. "categories"
|
||||
idKey?: string; // default "id"
|
||||
listKey?: string; // wrap key, e.g. "items"; omit if response is a bare array
|
||||
listQuery?: string; // extra query string appended to the list fetch, e.g. "includeInactive=true"
|
||||
columns: ColumnDef[];
|
||||
fields?: FieldDef[];
|
||||
canCreate?: boolean;
|
||||
@@ -55,7 +56,7 @@ export function AdminResource({ config }: { config: ResourceConfig }) {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const res = await fetch(url(), { cache: "no-store" });
|
||||
const res = await fetch(url(config.listQuery ? `?${config.listQuery}` : ""), { cache: "no-store" });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data?.error ?? "Failed to load");
|
||||
const list = config.listKey ? data?.[config.listKey] : data;
|
||||
@@ -66,7 +67,7 @@ export function AdminResource({ config }: { config: ResourceConfig }) {
|
||||
setLoading(false);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [config.basePath, config.listKey]);
|
||||
}, [config.basePath, config.listKey, config.listQuery]);
|
||||
|
||||
useEffect(() => {
|
||||
reload();
|
||||
|
||||
Reference in New Issue
Block a user