Move files to utils

This commit is contained in:
Ajay Ramachandran
2021-05-23 18:00:20 -04:00
parent 5c2ab9087a
commit d3210d4e27
6 changed files with 8 additions and 8 deletions

18
src/utils/redisKeys.ts Normal file
View File

@@ -0,0 +1,18 @@
import { Service, VideoID, VideoIDHash } from "../types/segments.model";
import { UserID } from "../types/user.model";
import { Logger } from "./logger";
export function skipSegmentsKey(videoID: VideoID, service: Service): string {
return "segments." + service + ".videoID." + videoID;
}
export function skipSegmentsHashKey(hashedVideoIDPrefix: VideoIDHash, service: Service): string {
hashedVideoIDPrefix = hashedVideoIDPrefix.substring(0, 4) as VideoIDHash;
if (hashedVideoIDPrefix.length !== 4) Logger.warn("Redis skip segment hash-prefix key is not length 4! " + hashedVideoIDPrefix);
return "segments." + service + "." + hashedVideoIDPrefix;
}
export function reputationKey(userID: UserID): string {
return "reputation.user." + userID;
}