fix non-format eslint in src/

This commit is contained in:
Michael C
2021-07-12 02:12:22 -04:00
parent 9445a06871
commit c0b1d201ad
66 changed files with 829 additions and 834 deletions

View File

@@ -1,10 +1,10 @@
import { Logger } from '../utils/logger';
import { HashedUserID, UserID } from '../types/user.model';
import { getHash } from '../utils/getHash';
import { Request, Response } from 'express';
import { Service, VideoID } from '../types/segments.model';
import { QueryCacher } from '../utils/queryCacher';
import { isUserVIP } from '../utils/isUserVIP';
import { Logger } from "../utils/logger";
import { HashedUserID, UserID } from "../types/user.model";
import { getHash } from "../utils/getHash";
import { Request, Response } from "express";
import { Service, VideoID } from "../types/segments.model";
import { QueryCacher } from "../utils/queryCacher";
import { isUserVIP } from "../utils/isUserVIP";
import { VideoIDHash } from "../types/segments.model";
export async function postClearCache(req: Request, res: Response): Promise<Response> {
@@ -13,17 +13,17 @@ export async function postClearCache(req: Request, res: Response): Promise<Respo
const service = req.query.service as Service ?? Service.YouTube;
const invalidFields = [];
if (typeof videoID !== 'string') {
invalidFields.push('videoID');
if (typeof videoID !== "string") {
invalidFields.push("videoID");
}
if (typeof userID !== 'string') {
invalidFields.push('userID');
if (typeof userID !== "string") {
invalidFields.push("userID");
}
if (invalidFields.length !== 0) {
// invalid request
const fields = invalidFields.reduce((p, c, i) => p + (i !== 0 ? ', ' : '') + c, '');
return res.status(400).send(`No valid ${fields} field(s) provided`);
// invalid request
const fields = invalidFields.reduce((p, c, i) => p + (i !== 0 ? ", " : "") + c, "");
return res.status(400).send(`No valid ${fields} field(s) provided`);
}
// hash the userID as early as possible
@@ -33,7 +33,7 @@ export async function postClearCache(req: Request, res: Response): Promise<Respo
// Ensure user is a VIP
if (!(await isUserVIP(hashedUserID))){
Logger.warn("Permission violation: User " + hashedUserID + " attempted to clear cache for video " + videoID + ".");
Logger.warn(`Permission violation: User ${hashedUserID} attempted to clear cache for video ${videoID}.`);
return res.status(403).json({"message": "Not a VIP"});
}
@@ -44,7 +44,7 @@ export async function postClearCache(req: Request, res: Response): Promise<Respo
service
});
return res.status(200).json({
message: "Cache cleared on video " + videoID
message: `Cache cleared on video ${videoID}`
});
} catch(err) {
return res.sendStatus(500);