mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-28 02:19:01 +00:00
Improve efficiency of calculateUserClientsForOrgs
This commit is contained in:
@@ -202,13 +202,11 @@ export async function acceptInvite(
|
||||
);
|
||||
});
|
||||
|
||||
calculateUserClientsForOrgs(existingUser[0].userId, primaryDb).catch(
|
||||
(e) => {
|
||||
logger.error(
|
||||
`Failed to calculate user clients after accepting invite for user ${existingUser[0].userId}: ${e}`
|
||||
);
|
||||
}
|
||||
);
|
||||
calculateUserClientsForOrgs(existingUser[0].userId).catch((e) => {
|
||||
logger.error(
|
||||
`Failed to calculate user clients after accepting invite for user ${existingUser[0].userId}: ${e}`
|
||||
);
|
||||
});
|
||||
|
||||
return response<AcceptInviteResponse>(res, {
|
||||
data: { accepted: true, orgId: existingInvite.orgId },
|
||||
|
||||
@@ -55,7 +55,7 @@ export async function adminRemoveUser(
|
||||
await trx.delete(users).where(eq(users.userId, userId));
|
||||
});
|
||||
|
||||
calculateUserClientsForOrgs(userId, primaryDb).catch((e) => {
|
||||
calculateUserClientsForOrgs(userId).catch((e) => {
|
||||
logger.error(
|
||||
`Failed to calculate user clients after removing user ${userId}: ${e}`
|
||||
);
|
||||
|
||||
@@ -56,7 +56,6 @@ const bodySchema = z
|
||||
export type CreateOrgUserResponse = {};
|
||||
const CreateOrgUserResponseDataSchema = z.object({});
|
||||
|
||||
|
||||
registry.registerPath({
|
||||
method: "put",
|
||||
path: "/org/{orgId}/user",
|
||||
@@ -77,7 +76,9 @@ registry.registerPath({
|
||||
description: "Successful response",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: createApiResponseSchema(CreateOrgUserResponseDataSchema)
|
||||
schema: createApiResponseSchema(
|
||||
CreateOrgUserResponseDataSchema
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -326,13 +327,11 @@ export async function createOrgUser(
|
||||
});
|
||||
|
||||
if (userIdForClients) {
|
||||
calculateUserClientsForOrgs(userIdForClients, primaryDb).catch(
|
||||
(e) => {
|
||||
logger.error(
|
||||
`Failed to calculate user clients after creating org user: ${e}`
|
||||
);
|
||||
}
|
||||
);
|
||||
calculateUserClientsForOrgs(userIdForClients).catch((e) => {
|
||||
logger.error(
|
||||
`Failed to calculate user clients after creating org user: ${e}`
|
||||
);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return next(
|
||||
|
||||
@@ -109,7 +109,7 @@ export async function removeUserOrg(
|
||||
await removeUserFromOrg(org, userId, trx);
|
||||
});
|
||||
|
||||
calculateUserClientsForOrgs(userId, primaryDb).catch((e) => {
|
||||
calculateUserClientsForOrgs(userId).catch((e) => {
|
||||
logger.error(
|
||||
`Failed to calculate user clients after removing user ${userId} from org ${orgId}: ${e}`
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user