Use transaction from middleware for more database queries (#6051)

This commit is contained in:
jannschu
2023-10-21 23:31:14 +02:00
committed by GitHub
parent 5df48b3204
commit 0518cdc6d9
7 changed files with 29 additions and 11 deletions

View File

@@ -32,6 +32,7 @@ router.post(
const { user } = ctx.state.auth;
const team = await Team.findByPk(user.teamId, {
include: [{ model: TeamDomain }],
transaction,
});
authorize(user, "update", team);
@@ -121,6 +122,7 @@ router.post(
"withAuthenticationProviders"
).findByPk(user.teamId, {
rejectOnEmpty: true,
transaction,
});
authorize(user, "createTeam", existingTeam);