mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
Fix tournamentLogoWithDefault function returning null instead of default
This commit is contained in:
parent
ff4402d9aa
commit
48d98b2a27
|
|
@ -81,26 +81,22 @@ export function tournamentLogoOrNull(
|
|||
* @returns A SQL expression that concatenates the image root URL with either the custom logo URL or default logo
|
||||
*/
|
||||
export function tournamentLogoWithDefault(
|
||||
/** Expression builder scoped to the CalendarEvent table */
|
||||
eb: ExpressionBuilder<Tables, "CalendarEvent">,
|
||||
) {
|
||||
return concatUserSubmittedImagePrefix(
|
||||
eb
|
||||
.selectFrom("UnvalidatedUserSubmittedImage")
|
||||
.select((eb) => [
|
||||
eb.fn
|
||||
.coalesce(
|
||||
"UnvalidatedUserSubmittedImage.url",
|
||||
sql.lit(`${import.meta.env.VITE_TOURNAMENT_DEFAULT_LOGO}`),
|
||||
)
|
||||
.as("url"),
|
||||
])
|
||||
.whereRef(
|
||||
"CalendarEvent.avatarImgId",
|
||||
"=",
|
||||
"UnvalidatedUserSubmittedImage.id",
|
||||
)
|
||||
.$asScalar(),
|
||||
eb.fn.coalesce(
|
||||
eb
|
||||
.selectFrom("UnvalidatedUserSubmittedImage")
|
||||
.select("UnvalidatedUserSubmittedImage.url")
|
||||
.whereRef(
|
||||
"CalendarEvent.avatarImgId",
|
||||
"=",
|
||||
"UnvalidatedUserSubmittedImage.id",
|
||||
)
|
||||
.$asScalar(),
|
||||
sql.lit(`${import.meta.env.VITE_TOURNAMENT_DEFAULT_LOGO}
|
||||
`),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user