Consistency fixes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user