fix: resolve TypeScript build errors from leftJoin nullable types
Some checks failed
Build and Push Backend Image / build (push) Successful in 42s
Build and Push Frontend Image / build (push) Has been cancelled

Non-null assert photo/achievement ids that are structurally non-null
due to FK constraints but nullable in Drizzle's leftJoin return type.
Add missing description field to enrichVideo model select and map.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 19:33:16 +01:00
parent a558449964
commit 90497e9e7c
4 changed files with 24 additions and 6 deletions

View File

@@ -41,6 +41,7 @@ async function enrichVideo(db: DB, video: typeof videos.$inferSelect) {
artist_name: users.artist_name,
slug: users.slug,
avatar: users.avatar,
description: users.description,
})
.from(video_models)
.leftJoin(users, eq(video_models.user_id, users.id))
@@ -63,9 +64,19 @@ async function enrichVideo(db: DB, video: typeof videos.$inferSelect) {
.from(video_plays)
.where(eq(video_plays.video_id, video.id));
const models = modelRows
.filter((m) => m.id !== null)
.map((m) => ({
id: m.id!,
artist_name: m.artist_name,
slug: m.slug,
avatar: m.avatar,
description: m.description,
}));
return {
...video,
models: modelRows,
models,
movie_file: movieFile,
likes_count: likesCount[0]?.count || 0,
plays_count: playsCount[0]?.count || 0,