feat: Add rescheduledBy & canceledBy fields in the DB (#15337)
* feat: Add rescheduledBy & canceledBy fields in the DB * fix: type check * fix: type check * fix: use session user email for reschedule * fix: unit test * feat: db field email validation * feat: rescheduledBy and cancelledBy in webhooks * revert unrelated changes. * make session user secondary, default to Anonymous * if condition not required * Make cancelledBy optional Co-authored-by: Syed Ali Shahbaz <[email protected]> * update cancel booking type * fix: update cancelledBy in db when requesting reschedule * remove default value for fields * fix: type check * feat: manage fields via api v1 * fix: add fields in booking read api v1 * test: expand to cover new fields * fix: use cancelledBy param on booking page --------- Co-authored-by: Anik Dhabal Babu <[email protected]> Co-authored-by: Syed Ali Shahbaz <[email protected]> Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
28 files changed
+139
-20
No files matched your search
@@ -163,6 +163,8 @@ export default function Success(props: PageProps) {
|
||||
const [calculatedDuration, setCalculatedDuration] = useState<number | undefined>(undefined);
|
||||
const [comment, setComment] = useState("");
|
||||
const parsedRating = rating ? parseInt(rating, 10) : 3;
|
||||
const currentUserEmail =
|
||||
searchParams?.get("cancelledBy") ?? searchParams?.get("email") ?? session?.user?.email ?? undefined;
|
||||
|
||||
const defaultRating = isNaN(parsedRating) ? 3 : parsedRating > 5 ? 5 : parsedRating < 1 ? 1 : parsedRating;
|
||||
const [rateValue, setRateValue] = useState<number>(defaultRating);
|
||||
@@ -700,7 +702,9 @@ export default function Success(props: PageProps) {
|
||||
<span className="text-default inline">
|
||||
<span className="underline" data-testid="reschedule-link">
|
||||
<Link
|
||||
href={`/reschedule/${seatReferenceUid || bookingInfo?.uid}`}
|
||||
href={`/reschedule/${seatReferenceUid || bookingInfo?.uid}${
|
||||
currentUserEmail ? `?rescheduledBy=${currentUserEmail}` : ""
|
||||
}`}
|
||||
legacyBehavior>
|
||||
{t("reschedule")}
|
||||
</Link>
|
||||
@@ -738,6 +742,7 @@ export default function Success(props: PageProps) {
|
||||
allRemainingBookings={allRemainingBookings}
|
||||
seatReferenceUid={seatReferenceUid}
|
||||
bookingCancelledEventProps={bookingCancelledEventProps}
|
||||
currentUserEmail={currentUserEmail}
|
||||
/>
|
||||
</>
|
||||
))}
|
||||
|
||||
Reference in new issue
Block a user