refactor: removed isNotAnApiCall (#13568)

This commit is contained in:
Omar López authored and GitHub committed 2024-02-07 04:43:36 -03:00
1 parent 8469c91973
commit d2b4760e3a
14 files changed
+593 -640

No files matched your search

+1 -3
View File
@@ -17,9 +17,7 @@ async function handler(req: NextApiRequest & { userId?: number }, res: NextApiRe
const session = await getServerSession({ req, res });
/* To mimic API behavior and comply with types */
req.userId = session?.user?.id || -1;
const booking = await handleNewBooking(req, {
isNotAnApiCall: true,
});
const booking = await handleNewBooking(req);
return booking;
}
+3 -9
View File
@@ -52,9 +52,7 @@ async function handler(req: NextApiRequest & { userId?: number }, res: NextApiRe
noEmail: false,
};
const firstBookingResult = await handleNewBooking(recurringEventReq, {
isNotAnApiCall: true,
});
const firstBookingResult = await handleNewBooking(recurringEventReq);
luckyUsers = firstBookingResult.luckyUsers?.map((user) => user.id);
}
@@ -92,12 +90,8 @@ async function handler(req: NextApiRequest & { userId?: number }, res: NextApiRe
luckyUsers,
};
const promiseEachRecurringBooking: ReturnType<typeof handleNewBooking> = handleNewBooking(
recurringEventReq,
{
isNotAnApiCall: true,
}
);
const promiseEachRecurringBooking: ReturnType<typeof handleNewBooking> =
handleNewBooking(recurringEventReq);
const eachRecurringBooking = await promiseEachRecurringBooking;