feat: finalize academy redesign and production readiness
Align admin, community, search, library, learning and course management with the mockup. Add saved courses, download history, public community feed, instructor directory, backend search, course views, admin content tools and community moderation. Harden API and Nginx for production.
This commit is contained in:
@@ -34,13 +34,35 @@ export interface ManagedUser {
|
||||
role: ApiRole;
|
||||
isActive: boolean;
|
||||
createdAt: string;
|
||||
lastAccessAt: string | null;
|
||||
}
|
||||
export interface ManagedUserDetail extends ManagedUser {
|
||||
completedLessons: number;
|
||||
lastLearningAt: string | null;
|
||||
}
|
||||
export interface PlatformAnalytics { totalUsers: number; activeUsers: number; publishedCourses: number; completedLessons: number; comments: number; }
|
||||
export interface InstructorAnalytics { courses: number; lessons: number; learners: number; completedLessons: number; comments: number; }
|
||||
export interface PlatformAnalytics { totalUsers: number; activeUsers: number; publishedCourses: number; completedLessons: number; comments: number; pendingInvitations: number; }
|
||||
export interface InstructorAnalytics { courses: number; lessons: number; learners: number; completedLessons: number; comments: number; unansweredComments: number; }
|
||||
export interface InstructorSummary {
|
||||
id: string;
|
||||
name: string;
|
||||
role: ApiRole;
|
||||
avatarImageUrl: string | null;
|
||||
headline: string;
|
||||
courseCount: number;
|
||||
}
|
||||
export interface DownloadRecord {
|
||||
id: string;
|
||||
name: string;
|
||||
kind: 'document' | 'spreadsheet' | 'archive' | 'image' | 'link';
|
||||
url: string;
|
||||
sizeBytes: number | null;
|
||||
description: string;
|
||||
createdAt: string;
|
||||
courseId: string | null;
|
||||
courseTitle: string | null;
|
||||
lessonNumber: number | null;
|
||||
downloadedAt: string;
|
||||
}
|
||||
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; }
|
||||
@@ -239,6 +261,7 @@ export const profileApi = {
|
||||
async update(input: ProfileInput) { return apiRequest<{ data: Profile }>('/profiles/me', { method: 'PATCH', body: JSON.stringify(input) }); },
|
||||
async public(profileId: string) { return apiRequest<{ data: Profile & { courses: unknown[] } }>(`/profiles/${profileId}`); },
|
||||
async instructor(instructorId: string) { return apiRequest<{ data: Profile & { courses: unknown[] } }>(`/profiles/instructors/${instructorId}`); },
|
||||
async instructors() { return apiRequest<{ data: InstructorSummary[] }>('/profiles/instructors'); },
|
||||
};
|
||||
|
||||
export const instructorApi = {
|
||||
@@ -267,4 +290,18 @@ export const courseApi = {
|
||||
async playback(courseId: string, lessonId: string) {
|
||||
return apiRequest<{ data: LessonPlayback }>(`/courses/${courseId}/lessons/${lessonId}/playback`);
|
||||
},
|
||||
async trackView(courseId: string) {
|
||||
return apiRequest<{ data: { views: number } }>(`/courses/${courseId}/view`, { method: 'POST' });
|
||||
},
|
||||
};
|
||||
|
||||
export const savedCourseApi = {
|
||||
async list() { return apiRequest<{ data: Array<{ courseId: string; createdAt: string }> }>('/saved-courses'); },
|
||||
async save(courseId: string) { return apiRequest<void>(`/saved-courses/${courseId}`, { method: 'PUT' }); },
|
||||
async remove(courseId: string) { return apiRequest<void>(`/saved-courses/${courseId}`, { method: 'DELETE' }); },
|
||||
};
|
||||
|
||||
export const downloadApi = {
|
||||
async list() { return apiRequest<{ data: DownloadRecord[] }>('/downloads'); },
|
||||
async record(assetId: string) { return apiRequest<void>(`/downloads/${assetId}`, { method: 'POST' }); },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user