feat: manage homepage banner carousel
This commit is contained in:
@@ -59,6 +59,20 @@ export interface LearningPathInput {
|
||||
kind: 'trail' | 'formation';
|
||||
courseIds: string[];
|
||||
}
|
||||
export interface HomeBannerInput {
|
||||
kind: 'course' | 'custom';
|
||||
courseId: string | null;
|
||||
imageUrl: string | null;
|
||||
title: string;
|
||||
description: string;
|
||||
}
|
||||
export interface HomeBanner extends HomeBannerInput {
|
||||
id: string;
|
||||
position: number;
|
||||
courseTitle: string | null;
|
||||
courseDescription: string | null;
|
||||
courseImageUrl: string | null;
|
||||
}
|
||||
|
||||
interface Session {
|
||||
token: string;
|
||||
@@ -170,6 +184,8 @@ export const adminApi = {
|
||||
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 homeBanners() { return apiRequest<{ data: HomeBanner[] }>('/admin/home-banners'); },
|
||||
async updateHomeBanners(banners: HomeBannerInput[]) { return apiRequest<{ data: HomeBanner[] }>('/admin/home-banners', { method: 'PUT', body: JSON.stringify({ banners }) }); },
|
||||
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