mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
fix: create global settings on team creation (#1601)
The global team settings weren't created when creating a new team. ## Changes Made The global team settings are now created when a new team is created.
This commit is contained in:
committed by
David Nguyen
parent
b0f8c83134
commit
0f50110853
@ -95,7 +95,7 @@ export const createTeam = async ({
|
||||
});
|
||||
}
|
||||
|
||||
await tx.team.create({
|
||||
const team = await tx.team.create({
|
||||
data: {
|
||||
name: teamName,
|
||||
url: teamUrl,
|
||||
@ -104,13 +104,23 @@ export const createTeam = async ({
|
||||
members: {
|
||||
create: [
|
||||
{
|
||||
userId,
|
||||
userId: user.id,
|
||||
role: TeamMemberRole.ADMIN,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await tx.teamGlobalSettings.upsert({
|
||||
where: {
|
||||
teamId: team.id,
|
||||
},
|
||||
update: {},
|
||||
create: {
|
||||
teamId: team.id,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
@ -225,6 +235,16 @@ export const createTeamFromPendingTeam = async ({
|
||||
},
|
||||
});
|
||||
|
||||
await tx.teamGlobalSettings.upsert({
|
||||
where: {
|
||||
teamId: team.id,
|
||||
},
|
||||
update: {},
|
||||
create: {
|
||||
teamId: team.id,
|
||||
},
|
||||
});
|
||||
|
||||
await tx.subscription.upsert(
|
||||
mapStripeSubscriptionToPrismaUpsertAction(subscription, undefined, team.id),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user