Hash my url (#2484)
* disposable link model added * disposable model updated * added disposable slug availability page * added disposable book page * added disposable slug hook * added disposable link booking flow * updated schema * checktype fix * added checkfix and schema generated * create link API added * added one time link view on event type list * adjusted schema * fixed disposable visual indicator * expired check and visual indicator added * updated slug for disposable event type * revised schema * WIP * revert desc * revert --WIP * rework based on change of plans * further adjustments * added eventtype option for hashed link * added refresh and delete on update * fixed update call conditions * cleanup * code improvement * clean up * Potential fix for 404 * backward compat for booking page * fixes regular booking for user and team * typefix * updated path for Booking import * checkfix * e2e wip * link err fix * workaround for banner issue in event type update-test * added regenerate hash check * fixed test according to new testID Co-authored-by: Hariom Balhara <[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:
14 files changed
+627
-3
No files matched your search
@@ -233,6 +233,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
const dynamicUserList = Array.isArray(reqBody.user)
|
||||
? getGroupName(req.body.user)
|
||||
: getUsernameList(reqBody.user as string);
|
||||
const hasHashedBookingLink = reqBody.hasHashedBookingLink;
|
||||
const eventTypeSlug = reqBody.eventTypeSlug;
|
||||
const eventTypeId = reqBody.eventTypeId;
|
||||
const tAttendees = await getTranslation(reqBody.language ?? "en", "common");
|
||||
@@ -780,6 +781,20 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
},
|
||||
},
|
||||
});
|
||||
// refresh hashed link if used
|
||||
const urlSeed = `${users[0].username}:${dayjs(req.body.start).utc().format()}`;
|
||||
const hashedUid = translator.fromUUID(uuidv5(urlSeed, uuidv5.URL));
|
||||
|
||||
if (hasHashedBookingLink) {
|
||||
await prisma.hashedLink.update({
|
||||
where: {
|
||||
link: reqBody.hashedLink as string,
|
||||
},
|
||||
data: {
|
||||
link: hashedUid,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// booking successful
|
||||
return res.status(201).json(booking);
|
||||
|
||||
Reference in new issue
Block a user