fix: 500 error on missing response id. Should be 400 (#20420)

* fix: 500 error on missing response id. Should be 400

* fix failing test
This commit is contained in:
Hariom Balhara
2025-03-28 07:53:32 +00:00
committed by GitHub
parent 96fcf7beec
commit 17f493a488
2 changed files with 5 additions and 0 deletions
@@ -456,6 +456,10 @@ async function handler(
let routingFormResponse = null;
if (routedTeamMemberIds) {
//routingFormResponseId could be 0 for dry run. So, we just avoid undefined value
if (routingFormResponseId === undefined) {
throw new HttpError({ statusCode: 400, message: "Missing routingFormResponseId" });
}
routingFormResponse = await prisma.app_RoutingForms_FormResponse.findUnique({
where: {
id: routingFormResponseId,
@@ -2638,6 +2638,7 @@ describe("handleNewBooking", () => {
start: `${plus1DateString}T04:00:00.000Z`,
end: `${plus1DateString}T04:15:00.000Z`,
routedTeamMemberIds: [101],
routingFormResponseId: 12323,
responses: {
email: booker.email,
name: booker.name,