feat: group cms courses by trail
All checks were successful
CI / Validate frontend and API (push) Successful in 2m3s
CI / Build and publish Docker images (push) Successful in 28s

This commit is contained in:
Cauê Faleiros
2026-09-08 09:30:01 -03:00
parent a6f53ff0d3
commit 815d3f93c1
3 changed files with 15 additions and 4 deletions

View File

@@ -266,7 +266,11 @@ export const adminRoutes: FastifyPluginAsync = async (app) => {
app.get('/home-configuration', adminAccess, async () => {
const [settings, courses] = await Promise.all([
pool.query<{ key: string; value: unknown }>(`select key, value from platform_settings where key in ('home.featuredCourseId', 'home.courseOrder', 'media.defaultCoverImageUrl')`),
pool.query<{ id: string; title: string; status: string }>(`select id, title, status from courses where status <> 'archived' order by title`),
pool.query<{ id: string; title: string; status: string; category: string; coverImageUrl: string | null }>(
`select id, title, status, category,
coalesce(cover_image_url, (select value #>> '{}' from platform_settings where key = 'media.defaultCoverImageUrl')) as "coverImageUrl"
from courses where status <> 'archived' order by category, title`,
),
]);
const values = new Map(settings.rows.map((row) => [row.key, row.value]));
return { data: {