Remove casting

This commit is contained in:
Ajay Ramachandran
2021-08-03 21:05:07 -04:00
parent 38a09b164d
commit 73dfe2ef11

View File

@@ -3,14 +3,14 @@ import {getHash} from "../utils/getHash";
import {Request, Response} from "express";
import { config } from "../config";
import { Category, Service, VideoID, VideoIDHash } from "../types/segments.model";
import { HashedUserID, UserID } from "../types/user.model";
import { UserID } from "../types/user.model";
import { QueryCacher } from "../utils/queryCacher";
import { isUserVIP } from "../utils/isUserVIP";
export async function shadowBanUser(req: Request, res: Response): Promise<Response> {
const userID = req.query.userID as string;
const userID = req.query.userID as UserID;
const hashedIP = req.query.hashedIP as string;
let adminUserIDInput = req.query.adminUserID as string;
const adminUserIDInput = req.query.adminUserID as UserID;
const enabled = req.query.enabled === undefined
? true
@@ -28,9 +28,9 @@ export async function shadowBanUser(req: Request, res: Response): Promise<Respon
}
//hash the userID
adminUserIDInput = getHash(adminUserIDInput);
const adminUserID = getHash(adminUserIDInput);
const isVIP = await isUserVIP(adminUserIDInput as HashedUserID);
const isVIP = await isUserVIP(adminUserID);
if (!isVIP) {
//not authorized
return res.sendStatus(403);