feat(api): add user search endpoint and normalize response data and validation
This commit is contained in:
parent
91f4c524b9
commit
c7b7d61cec
14 changed files with 574 additions and 368 deletions
|
@ -8,9 +8,8 @@ import Authentik from 'next-auth/providers/authentik';
|
|||
import { PrismaAdapter } from '@auth/prisma-adapter';
|
||||
import { prisma } from '@/prisma';
|
||||
|
||||
import { loginSchema } from './lib/validation/user';
|
||||
|
||||
import { ZodError } from 'zod';
|
||||
import { loginClientSchema } from './lib/validation/user';
|
||||
import { ZodError } from 'zod/v4';
|
||||
|
||||
class InvalidLoginError extends CredentialsSignin {
|
||||
constructor(code: string) {
|
||||
|
@ -38,7 +37,7 @@ const providers: Provider[] = [
|
|||
if (process.env.DISABLE_PASSWORD_LOGIN) return null;
|
||||
|
||||
try {
|
||||
const { email, password } = await loginSchema.parseAsync(c);
|
||||
const { email, password } = await loginClientSchema.parseAsync(c);
|
||||
|
||||
const user = await prisma.user.findFirst({
|
||||
where: { OR: [{ email }, { name: email }] },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue