mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-22 15:12:28 -04:00
Edit slug constraints on (kind, slug) for shows
This commit is contained in:
@@ -184,8 +184,8 @@ export const imagesH = new Elysia({ tags: ["images"] })
|
||||
.where(
|
||||
id !== "random"
|
||||
? isUuid(id)
|
||||
? eq(shows.id, id)
|
||||
: eq(shows.slug, id)
|
||||
? eq(staff.id, id)
|
||||
: eq(staff.slug, id)
|
||||
: undefined,
|
||||
)
|
||||
.orderBy(sql`random()`)
|
||||
|
||||
@@ -47,7 +47,7 @@ export const insertCollection = record(
|
||||
...col,
|
||||
})
|
||||
.onConflictDoUpdate({
|
||||
target: shows.slug,
|
||||
target: [shows.kind, shows.slug],
|
||||
set: {
|
||||
...conflictUpdateAllExcept(shows, [
|
||||
"pk",
|
||||
|
||||
@@ -119,7 +119,7 @@ async function insertBaseShow(tx: Transaction, show: Show) {
|
||||
.insert(shows)
|
||||
.values(show)
|
||||
.onConflictDoUpdate({
|
||||
target: shows.slug,
|
||||
target: [shows.kind, shows.slug],
|
||||
set: conflictUpdateAllExcept(shows, ["pk", "id", "slug", "createdAt"]),
|
||||
// if year is different, this is not an update but a conflict (ex: dune-1984 vs dune-2021)
|
||||
setWhere: sql`date_part('year', ${shows.startAir}) = date_part('year', excluded."start_air")`,
|
||||
|
||||
Reference in New Issue
Block a user