feat: initiated public profile

Signed-off-by: Adithya Krishna <aadithya794@gmail.com>
This commit is contained in:
Adithya Krishna
2024-05-01 16:16:55 +05:30
parent 15dee5ef35
commit 69c175d38e
9 changed files with 263 additions and 6 deletions

View File

@ -5,9 +5,10 @@ import { AppError, AppErrorCode } from '../../errors/app-error';
export type UpdatePublicProfileOptions = {
userId: number;
url: string;
bio?: string;
};
export const updatePublicProfile = async ({ userId, url }: UpdatePublicProfileOptions) => {
export const updatePublicProfile = async ({ userId, url, bio }: UpdatePublicProfileOptions) => {
const isUrlTaken = await prisma.user.findFirst({
select: {
id: true,
@ -37,10 +38,10 @@ export const updatePublicProfile = async ({ userId, url }: UpdatePublicProfileOp
userProfile: {
upsert: {
create: {
bio: '',
bio: bio,
},
update: {
bio: '',
bio: bio,
},
},
},