Skip to content

Commit

Permalink
feat(api): update create user schema
Browse files Browse the repository at this point in the history
  • Loading branch information
duongdev committed Jun 8, 2024
1 parent 89bba60 commit 54a13fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions apps/api/v1/services/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ export async function findUserById(id: string) {
})
}

export async function createUser(
data: CreateUser & {
id?: string
},
) {
export async function findUserByEmail(email: string) {
return await prisma.user.findUnique({
where: {
email,
},
})
}

export async function createUser(data: CreateUser) {
return await prisma.user.create({
data,
})
Expand Down
2 changes: 1 addition & 1 deletion apps/api/v1/validation/user.zod.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { z } from 'zod'

export const zCreateUser = z.object({
id: z.string().optional(),
email: z.string().email(),
password: z.string().min(6),
name: z.string().min(3),
})

Expand Down

0 comments on commit 54a13fc

Please sign in to comment.