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:
Catalin Pit
2025-01-28 07:16:18 +02:00
committed by David Nguyen
parent b0f8c83134
commit 0f50110853

View File

@ -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),
);