feat(gallery): add admin gallery curation endpoints and management page (Task 6)
Add super-admin-only backend endpoints for toggling is_gallery_featured and gallery_sort_order on flows and scripts, plus a frontend GalleryManagementPage with toggle switches, editable sort order fields, and name/featured filters. 13 integration tests; all pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,23 @@ export interface SurveyResponseListResponse {
|
||||
unread: number
|
||||
}
|
||||
|
||||
export interface GalleryFlowItem {
|
||||
id: string
|
||||
name: string
|
||||
tree_type: string
|
||||
is_gallery_featured: boolean
|
||||
gallery_sort_order: number
|
||||
visibility: string
|
||||
}
|
||||
|
||||
export interface GalleryScriptItem {
|
||||
id: string
|
||||
name: string
|
||||
is_gallery_featured: boolean
|
||||
gallery_sort_order: number
|
||||
is_active: boolean
|
||||
}
|
||||
|
||||
export const adminApi = {
|
||||
// Dashboard
|
||||
getDashboardMetrics: () =>
|
||||
@@ -194,6 +211,20 @@ export const adminApi = {
|
||||
api.delete(`/admin/survey-responses/${id}`),
|
||||
bulkActionResponses: (action: string, ids: string[]) =>
|
||||
api.post('/admin/survey-responses/bulk', { action, ids }).then(r => r.data),
|
||||
|
||||
// Gallery Curation
|
||||
getGalleryFeatured: () =>
|
||||
api.get<{ flows: GalleryFlowItem[]; scripts: GalleryScriptItem[] }>('/admin/gallery/featured').then(r => r.data),
|
||||
getGalleryAllItems: () =>
|
||||
api.get<{ flows: GalleryFlowItem[]; scripts: GalleryScriptItem[] }>('/admin/gallery/items').then(r => r.data),
|
||||
toggleFlowFeatured: (id: string, is_gallery_featured: boolean) =>
|
||||
api.patch<GalleryFlowItem>(`/admin/gallery/flows/${id}/feature`, { is_gallery_featured }).then(r => r.data),
|
||||
updateFlowSortOrder: (id: string, gallery_sort_order: number) =>
|
||||
api.patch<GalleryFlowItem>(`/admin/gallery/flows/${id}/sort-order`, { gallery_sort_order }).then(r => r.data),
|
||||
toggleScriptFeatured: (id: string, is_gallery_featured: boolean) =>
|
||||
api.patch<GalleryScriptItem>(`/admin/gallery/scripts/${id}/feature`, { is_gallery_featured }).then(r => r.data),
|
||||
updateScriptSortOrder: (id: string, gallery_sort_order: number) =>
|
||||
api.patch<GalleryScriptItem>(`/admin/gallery/scripts/${id}/sort-order`, { gallery_sort_order }).then(r => r.data),
|
||||
}
|
||||
|
||||
export default adminApi
|
||||
|
||||
Reference in New Issue
Block a user