Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(api): update create user schema #19

Merged
merged 1 commit into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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