Refactored queries.

This commit is contained in:
Mike Cao committed 2024-01-30 00:10:25 -08:00
1 parent 18e36aa7b3
commit b16f5cc067
67 files changed
+523 -576

No files matched your search

+2 -2
View File
@@ -9,7 +9,7 @@ import {
methodNotAllowed,
ok,
} from 'next-basics';
import { getUserById, updateUser } from 'queries';
import { getUser, updateUser } from 'queries';
import * as yup from 'yup';
export interface UserPasswordRequestQuery {
@@ -43,7 +43,7 @@ export default async (
const { id } = req.auth.user;
if (req.method === 'POST') {
const user = await getUserById(id, { includePassword: true });
const user = await getUser(id, { includePassword: true });
if (!checkPassword(currentPassword, user.password)) {
return badRequest(res, 'Current password is incorrect');