refactor(validation): restucture api input and output validation
This commit is contained in:
parent
30b2df9809
commit
afbefa8a52
34 changed files with 1890 additions and 1802 deletions
|
@ -2,12 +2,14 @@
|
|||
|
||||
import type { z } from 'zod/v4';
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { registerSchema } from '@/lib/validation/user';
|
||||
import { registerServerSchema } from './validation';
|
||||
import { prisma } from '@/prisma';
|
||||
|
||||
export async function registerAction(data: z.infer<typeof registerSchema>) {
|
||||
export async function registerAction(
|
||||
data: z.infer<typeof registerServerSchema>,
|
||||
) {
|
||||
try {
|
||||
const result = await registerSchema.safeParseAsync(data);
|
||||
const result = await registerServerSchema.safeParseAsync(data);
|
||||
|
||||
if (!result.success) {
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue