feat: role-based ACL + admin management UI
Backend: - Add acl.ts with requireAuth/requireRole/requireOwnerOrAdmin helpers - Gate premium videos from unauthenticated users in videos query/resolver - Fix updateVideoPlay to verify ownership before updating - Add admin mutations: adminListUsers, adminUpdateUser, adminDeleteUser - Add admin mutations: createVideo, updateVideo, deleteVideo, setVideoModels, adminListVideos - Add admin mutations: createArticle, updateArticle, deleteArticle, adminListArticles - Add deleteComment mutation (owner or admin only) - Add AdminUserListType to GraphQL types - Fix featured filter on articles query Frontend: - Install marked for markdown rendering - Add /admin/* section with sidebar layout and admin-only guard - Admin users page: paginated table with search, role filter, inline role change, delete - Admin videos pages: list, create form, edit form with file upload and model assignment - Admin articles pages: list, create form, edit form with split-pane markdown editor - Add admin nav link in header (desktop + mobile) for admin users - Render article content through marked in magazine detail page - Add all admin GraphQL service functions to services.ts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
15
packages/frontend/src/routes/admin/users/+page.server.ts
Normal file
15
packages/frontend/src/routes/admin/users/+page.server.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { adminListUsers } from "$lib/services";
|
||||
|
||||
export async function load({ fetch, url }) {
|
||||
const role = url.searchParams.get("role") || undefined;
|
||||
const search = url.searchParams.get("search") || undefined;
|
||||
const offset = parseInt(url.searchParams.get("offset") || "0", 10);
|
||||
const limit = 50;
|
||||
|
||||
const result = await adminListUsers({ role, search, limit, offset }, fetch).catch(() => ({
|
||||
items: [],
|
||||
total: 0,
|
||||
}));
|
||||
|
||||
return { ...result, role, search, offset, limit };
|
||||
}
|
||||
Reference in New Issue
Block a user