mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 09:12:02 +10:00
fix: wip
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { hash } from '@node-rs/bcrypt';
|
||||
import { IdentityProvider, TeamMemberInviteStatus } from '@prisma/client';
|
||||
import { TeamMemberInviteStatus } from '@prisma/client';
|
||||
|
||||
import { getStripeCustomerByUser } from '@documenso/ee/server-only/stripe/get-customer';
|
||||
import { updateSubscriptionItemQuantity } from '@documenso/ee/server-only/stripe/update-subscription-item-quantity';
|
||||
@ -39,22 +39,35 @@ export const createUser = async ({ name, email, password, signature, url }: Crea
|
||||
});
|
||||
|
||||
if (urlExists) {
|
||||
throw new AppError(AppErrorCode.PROFILE_URL_TAKEN, {
|
||||
throw new AppError('PROFILE_URL_TAKEN', {
|
||||
message: 'Profile username is taken',
|
||||
userMessage: 'The profile username is already taken',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
name,
|
||||
email: email.toLowerCase(),
|
||||
password: hashedPassword,
|
||||
signature,
|
||||
identityProvider: IdentityProvider.DOCUMENSO,
|
||||
url,
|
||||
},
|
||||
const user = await prisma.$transaction(async (tx) => {
|
||||
const user = await tx.user.create({
|
||||
data: {
|
||||
name,
|
||||
email: email.toLowerCase(),
|
||||
password: hashedPassword, // Todo: Drop password.
|
||||
signature,
|
||||
url,
|
||||
},
|
||||
});
|
||||
|
||||
await tx.account.create({
|
||||
data: {
|
||||
userId: user.id,
|
||||
type: 'emailPassword', // Todo
|
||||
provider: 'DOCUMENSO', // Todo: Enums
|
||||
providerAccountId: user.id.toString(),
|
||||
password: hashedPassword,
|
||||
},
|
||||
});
|
||||
|
||||
return user;
|
||||
});
|
||||
|
||||
const acceptedTeamInvites = await prisma.teamMemberInvite.findMany({
|
||||
|
||||
Reference in New Issue
Block a user