feat: group cms courses by trail
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user