mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-12-18 20:45:33 +00:00
Update availableSince of entries on POST /videos
This commit is contained in:
@@ -10,7 +10,7 @@ import { conflictUpdateAllExcept, sqlarr, values } from "~/db/utils";
|
||||
import type { SeedEntry as SEntry, SeedExtra as SExtra } from "~/models/entry";
|
||||
import { enqueueOptImage } from "../images";
|
||||
import { guessNextRefresh } from "../refresh";
|
||||
import { updateAvailableCount } from "./shows";
|
||||
import { updateAvailableCount, updateAvailableSince } from "./shows";
|
||||
|
||||
type SeedEntry = SEntry & {
|
||||
video?: undefined;
|
||||
@@ -192,16 +192,7 @@ export const insertEntries = async (
|
||||
if (!onlyExtras)
|
||||
await updateAvailableCount(tx, [show.pk], show.kind === "serie");
|
||||
|
||||
const entriesPk = [...new Set(vids.map((x) => x.entryPk))];
|
||||
await tx
|
||||
.update(entries)
|
||||
.set({ availableSince: sql`now()` })
|
||||
.where(
|
||||
and(
|
||||
eq(entries.pk, sql`any(${sqlarr(entriesPk)})`),
|
||||
isNull(entries.availableSince),
|
||||
),
|
||||
);
|
||||
await updateAvailableSince(tx,[...new Set(vids.map((x) => x.entryPk))]);
|
||||
return ret;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user