feat: manage homepage banner carousel
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user