feat: create new markNoShow endpoint (#15738)
* feat: create new markNoShow endpoint * chore: add schema * chore: update name * chore: save progress * refactor: improve code and types * fix: unit test * chore: improvements * chore: move query to booking repository * fix: type error
This commit is contained in:
1 parent
3ab735ba9c
commit
e075dcdeaa
13 files changed
+263
-115
No files matched your search
@@ -668,12 +668,9 @@ const Attendee = (attendeeProps: AttendeeProps & NoShowProps) => {
|
||||
const [openDropdown, setOpenDropdown] = useState(false);
|
||||
const { copyToClipboard, isCopied } = useCopy();
|
||||
|
||||
const noShowMutation = trpc.viewer.public.noShow.useMutation({
|
||||
const noShowMutation = trpc.viewer.markNoShow.useMutation({
|
||||
onSuccess: async (data) => {
|
||||
showToast(
|
||||
t("messageKey" in data && data.messageKey ? data.messageKey : data.message, { x: name || email }),
|
||||
"success"
|
||||
);
|
||||
showToast(data.message, "success");
|
||||
},
|
||||
onError: (err) => {
|
||||
showToast(err.message, "error");
|
||||
@@ -779,9 +776,9 @@ const GroupedAttendees = (groupedAttendeeProps: GroupedAttendeeProps) => {
|
||||
};
|
||||
});
|
||||
const { t } = useLocale();
|
||||
const noShowMutation = trpc.viewer.public.noShow.useMutation({
|
||||
const noShowMutation = trpc.viewer.markNoShow.useMutation({
|
||||
onSuccess: async (data) => {
|
||||
showToast(t("messageKey" in data && data.messageKey ? data.messageKey : data.message), "success");
|
||||
showToast(t(data.message), "success");
|
||||
},
|
||||
onError: (err) => {
|
||||
showToast(err.message, "error");
|
||||
|
||||
@@ -178,7 +178,7 @@ export default function Success(props: PageProps) {
|
||||
},
|
||||
});
|
||||
|
||||
const noShowMutation = trpc.viewer.public.noShow.useMutation({
|
||||
const hostNoShowMutation = trpc.viewer.public.markHostAsNoShow.useMutation({
|
||||
onSuccess: async () => {
|
||||
showToast("Thank you, feedback submitted", "success");
|
||||
},
|
||||
@@ -189,7 +189,7 @@ export default function Success(props: PageProps) {
|
||||
|
||||
useEffect(() => {
|
||||
if (noShow) {
|
||||
noShowMutation.mutate({ bookingUid: bookingInfo.uid, noShowHost: true });
|
||||
hostNoShowMutation.mutate({ bookingUid: bookingInfo.uid, noShowHost: true });
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
@@ -140,7 +140,7 @@ vi.mock("@calcom/trpc/react", () => ({
|
||||
submitRating: {
|
||||
useMutation: vi.fn(),
|
||||
},
|
||||
noShow: {
|
||||
markHostAsNoShow: {
|
||||
useMutation: vi.fn(),
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user