feat: derive course durations from video media
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user