feat: derive course durations from video media
All checks were successful
CI / Validate frontend and API (push) Successful in 38s
CI / Build and publish Docker images (push) Successful in 22s

This commit is contained in:
Cauê Faleiros
2026-09-04 14:52:47 -03:00
parent 7a01be2b59
commit 1a79fa447b
3 changed files with 40 additions and 23 deletions

View File

@@ -40,6 +40,14 @@ async function persistBunnyStatus(video: { id: string; status: string; durationS
where provider = 'bunny' and external_id = $1`,
[video.id, video.status, video.durationSeconds],
);
if (video.durationSeconds !== null) {
await pool.query(
`update lessons
set duration_seconds = $2
where id = (select lesson_id from lesson_media where provider = 'bunny' and external_id = $1)`,
[video.id, video.durationSeconds],
);
}
}
export const mediaRoutes: FastifyPluginAsync = async (app) => {