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

@@ -1,8 +1,15 @@
import { getHash } from "./getHash";
import { HashedValue } from "../types/hash.model";
import { ActionType, VideoID } from "../types/segments.model";
import { ActionType, VideoID, Service } from "../types/segments.model";
import { UserID } from "../types/user.model";
export function getSubmissionUUID(videoID: VideoID, actionType: ActionType, userID: UserID, startTime: number, endTime: number): HashedValue{
return `4${getHash(`${videoID}${startTime}${endTime}${userID}${actionType}`, 1)}` as HashedValue;
export function getSubmissionUUID(
videoID: VideoID,
actionType: ActionType,
userID: UserID,
startTime: number,
endTime: number,
service: Service
) : HashedValue {
return `5${getHash(`${videoID}${startTime}${endTime}${userID}${actionType}${service}`, 1)}` as HashedValue;
}

View File

@@ -38,7 +38,7 @@ export async function getReputation(userID: UserID): Promise<number> {
c."category" = "a"."category" LIMIT 1)
AND EXISTS (
SELECT * FROM "lockCategories" as l
WHERE l."videoID" = "a"."videoID" AND l."category" = "a"."category" LIMIT 1)
WHERE l."videoID" = "a"."videoID" AND l."service" = "a"."service" AND l."category" = "a"."category" LIMIT 1)
THEN 1 ELSE 0 END) AS "mostUpvotedInLockedVideoSum"
FROM "sponsorTimes" as "a" WHERE "userID" = ?`, [userID, weekAgo, pastDate, userID]) as Promise<ReputationDBResult>;