mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
- Renamed files and directories to reflect the new structure - Moved comment-related services to the 'comments' directory - Moved image-related services to the 'images' directory - Moved like-related services to the 'likes' directory - Moved post-related services to the 'posts' directory - Moved user-related services to the 'users' directory
38 lines
848 B
TypeScript
38 lines
848 B
TypeScript
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,
|
|
accountIsVerified: true,
|
|
updatedAt: true,
|
|
role: true,
|
|
userAvatar: {
|
|
select: {
|
|
path: true,
|
|
alt: true,
|
|
caption: true,
|
|
createdAt: true,
|
|
id: true,
|
|
updatedAt: true,
|
|
},
|
|
},
|
|
bio: true,
|
|
},
|
|
});
|
|
|
|
return user;
|
|
};
|
|
|
|
export default findUserById;
|