fix: allow editing empty draft trails
All checks were successful
CI / Validate frontend and API (push) Successful in 35s
CI / Build and publish Docker images (push) Successful in 21s

This commit is contained in:
Cauê Faleiros
2026-09-08 16:10:53 -03:00
parent bdaff3f5df
commit 61359a22a5
3 changed files with 35 additions and 8 deletions

View File

@@ -74,6 +74,13 @@ export interface LearningPathInput {
status: 'draft' | 'published';
courseIds: string[];
}
export interface TrailCourseOption {
id: string;
title: string;
status: 'draft' | 'published';
category: string;
coverImageUrl: string | null;
}
export interface HomeBannerInput {
kind: 'course' | 'custom';
courseId: string | null;
@@ -197,6 +204,7 @@ export const adminApi = {
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 listPathCourses() { return apiRequest<{ data: TrailCourseOption[] }>('/admin/path-courses'); },
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' }); },