add service to table only have videoID

This commit is contained in:
Haidang666
2021-09-30 13:56:55 +07:00
parent 99d72b92e4
commit 356974b478
18 changed files with 188 additions and 60 deletions

View File

@@ -290,7 +290,8 @@ export async function voteOnSponsorTime(req: Request, res: Response): Promise<Re
if (!isVIP && type != 1) {
const isSegmentLocked = async () => !!(await db.prepare("get", `SELECT "locked" FROM "sponsorTimes" WHERE "UUID" = ?`, [UUID]))?.locked;
const isVideoLocked = async () => !!(await db.prepare("get", `SELECT "lockCategories".category from "lockCategories" left join "sponsorTimes"
on ("lockCategories"."videoID" = "sponsorTimes"."videoID" and "lockCategories".category = "sponsorTimes".category)
on ("lockCategories"."videoID" = "sponsorTimes"."videoID" and
"lockCategories"."service" = "sponsorTimes"."service" and "lockCategories".category = "sponsorTimes".category)
where "UUID" = ?`, [UUID]));
if (await isSegmentLocked() || await isVideoLocked()) {