feat: add managed learning paths
All checks were successful
CI / Validate frontend and API (push) Successful in 41s
CI / Build and publish Docker images (push) Successful in 23s

This commit is contained in:
Cauê Faleiros
2026-09-04 16:22:09 -03:00
parent e18bb76630
commit 79d1c70c44
9 changed files with 358 additions and 337 deletions

View File

@@ -44,6 +44,23 @@ type ApiCourse = {
assets: ApiAsset[];
};
export type PublicLearningPath = {
id: string;
title: string;
description: string;
coverImageUrl: string | null;
coverImageZoom: number;
coverImagePositionX: number;
coverImagePositionY: number;
courses: Array<{
id: string;
title: string;
category: string;
coverImageUrl: string | null;
position: number;
}>;
};
const toAttachmentType = (kind: ApiAsset['kind']): AttachmentType => {
if (kind === 'document') return 'doc';
if (kind === 'archive') return 'zip';
@@ -173,6 +190,11 @@ export const getCourses = async (): Promise<Course[]> => {
return response.data.map(toCourse);
};
export const getLearningPaths = async (): Promise<PublicLearningPath[]> => {
const response = await apiRequest<{ data: PublicLearningPath[] }>('/courses/paths');
return response.data;
};
export const getManagedCourses = async (): Promise<Course[]> => {
const response = await apiRequest<{ data: ApiCourse[] }>('/manage/courses');
return response.data.map(toCourse);