Implement login, add useUser hook

This commit is contained in:
Aaron William Po
2023-02-06 17:17:11 -05:00
parent 087a1a4513
commit 9a9d8bcb94
18 changed files with 336 additions and 43 deletions

View File

@@ -0,0 +1,23 @@
import DBClient from '@/prisma/DBClient';
import { z } from 'zod';
import GetUserSchema from './schema/GetUserSchema';
const findUserById = async (id: string) => {
const user: z.infer<typeof GetUserSchema> | null =
await DBClient.instance.user.findUnique({
where: { id },
select: {
id: true,
username: true,
email: true,
firstName: true,
lastName: true,
dateOfBirth: true,
createdAt: true,
},
});
return user;
};
export default findUserById;