Skip to content

Commit

Permalink
Merge branch 'dev' into feat/SSOTEAM-1221-01
Browse files Browse the repository at this point in the history
  • Loading branch information
NithinKuruba committed Dec 18, 2023
2 parents b8d74d3 + be7c5f1 commit 1fa2e2b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/controllers/keycloak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const removeUserAsRealmAdmin = async (emails: (string | null)[], env: str
return;
}

const role = await kcAdminClient.roles.findOneByName({ realm: 'master', name: `${realm}-realm-admins` });
const role = await kcAdminClient.roles.findOneByName({ realm: 'master', name: `${realm}-realm-admin` });

if (role === null) return;

Expand Down
29 changes: 15 additions & 14 deletions app/pages/api/realms/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,30 +265,31 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
if (!prResponse?.data.number) {
console.info(`PR Failed for deletion of realm id ${id}`);
// Intentionally not awaiting since 500 already, handling error async
failPR().catch((err) => console.error(err));
await failPR().catch((err) => console.error(err));
return res.status(500).send('Unexpected error removing request. Please try again.');
}

const pr = await mergePullRequest(prResponse.data.number);
if (!pr.data.merged) {
console.info(`Failed to merge pull request for realm id ${id}`);
failPR().catch((err) => console.error(err));
await failPR().catch((err) => console.error(err));
return res.status(500).send('Unexpected error removing request. Please try again.');
}

await deleteBranch(realm.realm!);

prisma.roster.update({
data: {
archived: true,
prNumber: prResponse.data.number,
status: StatusEnum.PRSUCCESS,
},
where: {
id: parseInt(id as string, 10),
},
});
sendDeleteEmail(realm, session);
await Promise.all([
prisma.roster.update({
data: {
archived: true,
prNumber: prResponse.data.number,
status: StatusEnum.PRSUCCESS,
},
where: {
id: parseInt(id as string, 10),
},
}),
sendDeleteEmail(realm, session),
]);
res.status(200).send('Success');
} else {
return res.status(404).json({ success: false, error: 'not found' });
Expand Down
2 changes: 1 addition & 1 deletion app/pages/api/realms/pending.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
);
}),
);
sendDeletionCompleteEmail(currentRequest);
await sendDeletionCompleteEmail(currentRequest);
} else if (success && action === ActionEnum.TF_APPLY) {
const currentRequest = await prisma.roster.findUnique({
where: {
Expand Down

0 comments on commit 1fa2e2b

Please sign in to comment.