mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 20:42:34 +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: {
|
data: {
|
||||||
name: teamName,
|
name: teamName,
|
||||||
url: teamUrl,
|
url: teamUrl,
|
||||||
@ -104,13 +104,23 @@ export const createTeam = async ({
|
|||||||
members: {
|
members: {
|
||||||
create: [
|
create: [
|
||||||
{
|
{
|
||||||
userId,
|
userId: user.id,
|
||||||
role: TeamMemberRole.ADMIN,
|
role: TeamMemberRole.ADMIN,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await tx.teamGlobalSettings.upsert({
|
||||||
|
where: {
|
||||||
|
teamId: team.id,
|
||||||
|
},
|
||||||
|
update: {},
|
||||||
|
create: {
|
||||||
|
teamId: team.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
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(
|
await tx.subscription.upsert(
|
||||||
mapStripeSubscriptionToPrismaUpsertAction(subscription, undefined, team.id),
|
mapStripeSubscriptionToPrismaUpsertAction(subscription, undefined, team.id),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user