diff --git a/src/lib/auth.ts b/src/lib/auth.ts index 4d074bc..33e837c 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -2,11 +2,11 @@ import { MySql2Database } from 'drizzle-orm/mysql2' import { users } from './tables' import { eq } from 'drizzle-orm' -export async function checkAuthorization ( +export const checkAuthorization = async ( authorizationToken: string, db0: MySql2Database, updateIp: string | null -) { +) => { if (!authorizationToken) return { valid: false, id: 0 } const userData = await db0 diff --git a/src/lib/util.ts b/src/lib/util.ts index ff57e2e..4fbee5a 100644 --- a/src/lib/util.ts +++ b/src/lib/util.ts @@ -14,14 +14,14 @@ import { createHash } from 'crypto' import { and, eq, sql } from 'drizzle-orm' import { verifyCodes } from './tables' -export function jsonResponse (data: any, status = 200) { +export const jsonResponse = (data: any, status = 200) => { return new Response(JSON.stringify(data, null, 2), { status, headers: { 'Content-Type': 'application/json' } }) } -export function getDatabaseConnection (type: number) { +export const getDatabaseConnection = (type: number) => { if (type !== 0 && type !== 1) return null const env = @@ -199,6 +199,6 @@ export const sendEmail = async (to: string, title: string, body: string) => { return await transporter.sendMail(mailOptions) } -export function hash (input: string, type: string): string { +export const hash = (input: string, type: string): string => { return createHash(type).update(input).digest('hex') }