feat: update signin signup ui

Signed-off-by: Adithya Krishna <adithya@documenso.com>
This commit is contained in:
Adithya Krishna
2024-02-22 01:57:46 +05:30
committed by Mythie
parent deea6b1535
commit 65d762dd4b
24 changed files with 889 additions and 207 deletions

View File

@ -0,0 +1,14 @@
import { prisma } from '@documenso/prisma';
import type { UserProfile } from '@documenso/prisma/client';
export interface GetPublicProfileByURLOptions {
profileURL: UserProfile['profileURL'];
}
export const getPublicProfileByURL = async ({ profileURL }: GetPublicProfileByURLOptions) => {
return await prisma.userProfile.findFirstOrThrow({
where: {
profileURL: profileURL,
},
});
};

View File

@ -0,0 +1,32 @@
import { prisma } from '@documenso/prisma';
import type { User, UserProfile } from '@documenso/prisma/client';
import { getUserById } from './get-user-by-id';
export type UpdatePublicProfileOptions = {
id: User['id'];
userProfile: UserProfile;
};
export const updatePublicProfile = async ({ id, userProfile }: UpdatePublicProfileOptions) => {
const user = await getUserById({ id });
console.log('Adi', user);
// Existence check
await prisma.userProfile.findFirstOrThrow({
where: {
profileURL: user.profileURL ?? '',
},
});
return await prisma.$transaction(async (tx) => {
await tx.userProfile.update({
where: {
profileURL: user.profileURL!,
},
data: {
profileURL: userProfile.profileURL,
profileBio: userProfile.profileBio,
},
});
});
};