reverse change

This commit is contained in:
Chen, Tai-Lin committed 2024-03-25 14:53:44 +08:00
1 parent c4fd92e289
commit 59a0865157
9 files changed
+14 -17

No files matched your search

@@ -17,7 +17,7 @@ export async function commandListController(req, res) {
nextKey: newNextKey, nextKey: newNextKey,
order: pagination.getOrder(), order: pagination.getOrder(),
}) })
} catch (error: any) { } catch (error) {
console.error(error) console.error(error)
res.status(500).send('Error fetching data') res.status(500).send('Error fetching data')
} }
@@ -15,7 +15,7 @@ export async function sessionListController(req, res) {
nextKey: newNextKey, nextKey: newNextKey,
order: pagination.getOrder(), order: pagination.getOrder(),
}) })
} catch (error: any) { } catch (error) {
console.log(error) console.log(error)
res.status(500).send('Error fetching session data') res.status(500).send('Error fetching session data')
} }
+1 -1
View File
@@ -15,7 +15,7 @@ export async function userListController(req, res) {
nextKey: newNextKey, nextKey: newNextKey,
order: pagination.getOrder(), order: pagination.getOrder(),
}) })
} catch (error: any) { } catch (error) {
console.error(error) console.error(error)
res.status(500).send('Error fetching user data') res.status(500).send('Error fetching user data')
} }
+1 -1
View File
@@ -3,7 +3,7 @@ import { Strategy as GoogleStrategy } from 'passport-google-oidc'
import config from '../config.js' import config from '../config.js'
import oauthVerify from './oauthVerify.js' import oauthVerify from './oauthVerify.js'
function verify(profile: any, cb: any) { function verify(issuer: string, profile: any, cb: any) {
oauthVerify('google', profile, { 'socialLogins.google.id': profile.id }, cb) oauthVerify('google', profile, { 'socialLogins.google.id': profile.id }, cb)
} }
+2 -2
View File
@@ -9,7 +9,7 @@ async function verifyPassword(
username: string, username: string,
password: string, password: string,
done: ( done: (
error: Error | null, error: any,
user?: Express.User | false, user?: Express.User | false,
options?: IVerifyOptions options?: IVerifyOptions
) => void ) => void
@@ -34,7 +34,7 @@ async function verifyPassword(
username: user.username, username: user.username,
email: user.email, email: user.email,
}) })
} catch (err: any) { } catch (err) {
return done(err) return done(err)
} }
} }
+2 -2
View File
@@ -82,7 +82,7 @@ export async function deleteContainer(id: string) {
} }
try { try {
await container.stop() await container.stop()
} catch (error: any) { } catch (error) {
logger.warn('Failed to stop container', id) logger.warn('Failed to stop container', id)
} }
await container.remove() await container.remove()
@@ -127,7 +127,7 @@ export function buildQuestImage(questPath: string, questId: string) {
.forEach((line: string) => { .forEach((line: string) => {
parseJSONOutput(line) parseJSONOutput(line)
}) })
} catch (error: any) { } catch (error) {
reject(error) reject(error)
} }
}) })
+2 -5
View File
@@ -1,10 +1,7 @@
import type { Request, Response, NextFunction } from 'express' import type { Request, Response, NextFunction } from 'express'
import logger from '../utils/logger.js' import logger from '../utils/logger.js'
export function asyncHandler( export function asyncHandler(fn: any) {
// eslint-disable-next-line no-unused-vars
fn: (req: Request, res: Response, next: NextFunction) => Promise<void>
) {
return (req: Request, res: Response, next: NextFunction) => { return (req: Request, res: Response, next: NextFunction) => {
fn(req, res, next).catch(next) fn(req, res, next).catch(next)
} }
@@ -12,7 +9,7 @@ export function asyncHandler(
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
export default function errorHandler( export default function errorHandler(
err: Error, err: any,
req: Request, req: Request,
res: Response, res: Response,
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
+1 -1
View File
@@ -6,7 +6,7 @@ export function hashPassword(password: string): Promise<string> {
return bcrypt.hash(password, 10) return bcrypt.hash(password, 10)
} }
export function genJWT(payload: { [key: string]: string }): Promise<string> { export function genJWT(payload: any): Promise<string> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
jwt.sign( jwt.sign(
payload, payload,
+3 -3
View File
@@ -9,9 +9,9 @@ const questDirectory = path.join(process.cwd(), '..', 'quests')
class QuestValidationError extends Error { class QuestValidationError extends Error {
questId: string questId: string
error: Error | null error: any
constructor(message: string, questId: string, error: Error | null) { constructor(message: string, questId: string, error: any) {
super(message) super(message)
this.name = 'QuestValidationError' this.name = 'QuestValidationError'
this.questId = questId this.questId = questId
@@ -68,7 +68,7 @@ export async function loadAndUpdateQuests() {
}) })
quest.exceptions.push(...exceptions) quest.exceptions.push(...exceptions)
await quest.save() await quest.save()
} catch (error: any) { } catch (error) {
logger.error(`Error parsing quest`, { id, error }) logger.error(`Error parsing quest`, { id, error })
throw new QuestValidationError(`Error parsing quest`, id, error) throw new QuestValidationError(`Error parsing quest`, id, error)
} }