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

@@ -176,6 +176,19 @@ export const courseRoutes: FastifyPluginAsync = async (app) => {
return { data: result.rows };
});
app.get('/home-banners', async () => {
const result = await pool.query(
`select b.id, b.kind, b.course_id as "courseId", b.image_url as "imageUrl", b.title, b.description, b.position,
c.title as "courseTitle", c.description as "courseDescription", c.cover_image_url as "courseImageUrl",
c.cover_image_zoom as "coverImageZoom", c.cover_image_position_x as "coverImagePositionX", c.cover_image_position_y as "coverImagePositionY"
from home_banners b
left join courses c on c.id = b.course_id and c.status = 'published'
where b.kind = 'custom' or c.id is not null
order by b.position`,
);
return { data: result.rows };
});
app.get('/me/learning', { preHandler: app.authenticate }, async (request) => {
const result = await pool.query(
`select base.*, coalesce(progress.progress, 0)::int as progress, progress."lastActivity"