Dynamic Links re-integrate with availability logic (#3687)
* -re init dynamic links * typing fix 001 * added missing div closing tag * added necessary DB column pull to satisfy Type errors * further type fixes * WIP * removed console logs * some revert * WIP * another approach * enabled dynamic links availability fetch * Added users to eventTypeObject for consistency * WIP: Moving user and changing map item name * Fix user list call * Removed explicit User type in map * modify default user attributes * adds explicit users to EventTypeObject in teams * Updated availability page * Updates Availability * Futher availability change * Remove explicit user type from slot router * more fixes * more fixes WIP * cleaning up more errors WIP * object assign used for typesafety * added check if dynamic booking is allowed by all users * cleaned up console logs * clean up * Improvement * resolving suggestions by alex * changes requested by Omar * Filter out empty usernames instead of accepting null Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: zomars <[email protected]>
This commit is contained in:
17 files changed
+197
-101
No files matched your search
@@ -258,6 +258,13 @@ async function handler(req: NextApiRequest) {
|
||||
...userSelect,
|
||||
})
|
||||
: eventType.users;
|
||||
const isDynamicAllowed = !users.some((user) => !user.allowDynamicBooking);
|
||||
if (!isDynamicAllowed) {
|
||||
throw new HttpError({
|
||||
message: "Some of the users in this group do not allow dynamic booking",
|
||||
statusCode: 400,
|
||||
});
|
||||
}
|
||||
|
||||
/* If this event was pre-relationship migration */
|
||||
if (!users.length && eventType.userId) {
|
||||
@@ -270,6 +277,9 @@ async function handler(req: NextApiRequest) {
|
||||
if (!eventTypeUser) throw new HttpError({ statusCode: 404, message: "eventTypeUser.notFound" });
|
||||
users.push(eventTypeUser);
|
||||
}
|
||||
|
||||
if (!users) throw new HttpError({ statusCode: 404, message: "eventTypeUser.notFound" });
|
||||
|
||||
const [organizerUser] = users;
|
||||
/**
|
||||
* @TODO: add a validation to check if organizerUser is found, otherwise it will throw error on user not found
|
||||
@@ -285,7 +295,6 @@ async function handler(req: NextApiRequest) {
|
||||
});
|
||||
|
||||
const tOrganizer = await getTranslation(organizer?.locale ?? "en", "common");
|
||||
|
||||
if (eventType.schedulingType === SchedulingType.ROUND_ROBIN) {
|
||||
const bookingCounts = await getUserNameWithBookingCounts(
|
||||
eventTypeId,
|
||||
|
||||
Reference in new issue
Block a user