feat: manage homepage banner carousel
All checks were successful
CI / Validate frontend and API (push) Successful in 35s
CI / Build and publish Docker images (push) Successful in 20s

This commit is contained in:
Cauê Faleiros
2026-09-04 16:44:34 -03:00
parent 09d85a7123
commit 5b86d6ef0d
7 changed files with 150 additions and 81 deletions

View File

@@ -62,6 +62,22 @@ export type PublicLearningPath = {
}>;
};
export type PublicHomeBanner = {
id: string;
kind: 'course' | 'custom';
courseId: string | null;
imageUrl: string | null;
title: string;
description: string;
position: number;
courseTitle: string | null;
courseDescription: string | null;
courseImageUrl: string | null;
coverImageZoom: number | null;
coverImagePositionX: number | null;
coverImagePositionY: number | null;
};
const toAttachmentType = (kind: ApiAsset['kind']): AttachmentType => {
if (kind === 'document') return 'doc';
if (kind === 'archive') return 'zip';
@@ -196,6 +212,11 @@ export const getLearningPaths = async (): Promise<PublicLearningPath[]> => {
return response.data;
};
export const getHomeBanners = async (): Promise<PublicHomeBanner[]> => {
const response = await apiRequest<{ data: PublicHomeBanner[] }>('/courses/home-banners');
return response.data;
};
export const getManagedCourses = async (): Promise<Course[]> => {
const response = await apiRequest<{ data: ApiCourse[] }>('/manage/courses');
return response.data.map(toCourse);