feat: add managed learning paths
This commit is contained in:
@@ -27,6 +27,36 @@ export interface InstructorAnalytics { courses: number; lessons: number; learner
|
||||
export interface AuditEntry { id: string; action: string; subjectType: string; subjectId: string | null; metadata: Record<string, unknown>; createdAt: string; actorName: string; }
|
||||
export interface BunnyVideo { id: string; title: string; status: 'processing' | 'ready' | 'failed'; providerStatus: number; encodeProgress: number; durationSeconds: number | null; }
|
||||
export interface LessonPlayback { provider: string; kind: 'embed' | 'video'; embedUrl?: string; source?: string; expiresAt?: string; }
|
||||
export interface LearningPathCourse {
|
||||
id: string;
|
||||
title: string;
|
||||
status: 'draft' | 'published' | 'archived';
|
||||
coverImageUrl: string | null;
|
||||
position: number;
|
||||
}
|
||||
export interface LearningPath {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
coverImageUrl: string | null;
|
||||
coverImageZoom: number;
|
||||
coverImagePositionX: number;
|
||||
coverImagePositionY: number;
|
||||
status: 'draft' | 'published' | 'archived';
|
||||
publishedAt: string | null;
|
||||
createdAt: string;
|
||||
courses: LearningPathCourse[];
|
||||
}
|
||||
export interface LearningPathInput {
|
||||
title: string;
|
||||
description: string;
|
||||
coverImageUrl: string | null;
|
||||
coverImageZoom: number;
|
||||
coverImagePositionX: number;
|
||||
coverImagePositionY: number;
|
||||
status: 'draft' | 'published';
|
||||
courseIds: string[];
|
||||
}
|
||||
|
||||
interface Session {
|
||||
token: string;
|
||||
@@ -134,6 +164,10 @@ export const adminApi = {
|
||||
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 listPaths() { return apiRequest<{ data: LearningPath[] }>('/admin/paths'); },
|
||||
async createPath(input: LearningPathInput) { return apiRequest<{ data: LearningPath }>('/admin/paths', { method: 'POST', body: JSON.stringify(input) }); },
|
||||
async updatePath(pathId: string, input: LearningPathInput) { return apiRequest<{ data: LearningPath }>(`/admin/paths/${pathId}`, { method: 'PATCH', body: JSON.stringify(input) }); },
|
||||
async deletePath(pathId: string) { return apiRequest<void>(`/admin/paths/${pathId}`, { method: 'DELETE' }); },
|
||||
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) }); },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user