feat: complete platform operations roadmap
This commit is contained in:
@@ -121,6 +121,11 @@ export const adminApi = {
|
||||
},
|
||||
async userDetail(userId: string) { return apiRequest<{ data: ManagedUserDetail }>(`/admin/users/${userId}`); },
|
||||
async auditLog() { return apiRequest<{ data: AuditEntry[] }>('/admin/audit-log'); },
|
||||
async categories() { return apiRequest<{ data: Array<{ id: string; name: string; position: number; isActive: boolean }> }>('/admin/categories'); },
|
||||
async createCategory(name: string) { return apiRequest<{ data: { id: string; name: string; position: number; isActive: boolean } }>('/admin/categories', { method: 'POST', body: JSON.stringify({ name }) }); },
|
||||
async updateCategory(categoryId: string, update: { name: string; isActive?: boolean; position?: number }) { return apiRequest<{ data: { id: string; name: string; position: number; isActive: boolean } }>(`/admin/categories/${categoryId}`, { method: 'PATCH', body: JSON.stringify(update) }); },
|
||||
async homeConfiguration() { return apiRequest<{ data: { featuredCourseId: string | null; courseOrder: string[]; defaultCoverImageUrl: string | null; courses: Array<{ id: string; title: string; status: string }> } }>('/admin/home-configuration'); },
|
||||
async updateHomeConfiguration(input: { featuredCourseId: string | null; courseOrder: string[]; defaultCoverImageUrl: string | null }) { return apiRequest<{ data: typeof input }>('/admin/home-configuration', { method: 'PUT', body: JSON.stringify(input) }); },
|
||||
};
|
||||
|
||||
export const instructorApi = {
|
||||
@@ -138,6 +143,7 @@ export const instructorApi = {
|
||||
};
|
||||
|
||||
export const courseApi = {
|
||||
async categories() { return apiRequest<{ data: string[] }>('/courses/categories'); },
|
||||
async playback(courseId: string, lessonId: string) {
|
||||
return apiRequest<{ data: LessonPlayback }>(`/courses/${courseId}/lessons/${lessonId}/playback`);
|
||||
},
|
||||
|
||||
@@ -66,7 +66,7 @@ const toCourse = (course: ApiCourse): Course => ({
|
||||
title: course.title,
|
||||
description: course.description,
|
||||
category: course.category,
|
||||
thumbnail: course.coverImageUrl || 'https://images.unsplash.com/photo-1460925895917-afdab827c52f?auto=format&fit=crop&w=800&q=80',
|
||||
thumbnail: course.coverImageUrl || '/course-placeholder.svg',
|
||||
instructor: course.instructor.name,
|
||||
status: course.status === 'draft' ? 'draft' : 'published',
|
||||
progress: course.progress,
|
||||
@@ -186,6 +186,10 @@ export const deleteCourse = async (id: string): Promise<void> => {
|
||||
await apiRequest(`/manage/courses/${id}`, { method: 'DELETE' });
|
||||
};
|
||||
|
||||
export const duplicateCourse = async (id: string): Promise<void> => {
|
||||
await apiRequest(`/manage/courses/${id}/duplicate`, { method: 'POST' });
|
||||
};
|
||||
|
||||
type ApiComment = {
|
||||
id: string;
|
||||
courseId: string;
|
||||
|
||||
Reference in New Issue
Block a user