fix: add eventTypeId and eventTypeSlug guard (#25773)
* fix: add eventTypeId and eventTypeSlug guard * chore: update test * refactor: improvemnt * revert: --------- Co-authored-by: Syed Ali Shahbaz <[email protected]>
This commit is contained in:
1 parent
c52eff65a2
commit
2c7cb530a1
2 files changed
+8
-1
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { getDefaultEvent } from "@calcom/features/eventtypes/lib/defaultEvents";
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||
|
||||
import { getBookingFieldsWithSystemFields } from "../getBookingFields";
|
||||
@@ -11,6 +12,10 @@ const _getEventType = async ({
|
||||
eventTypeId: number;
|
||||
eventTypeSlug?: string;
|
||||
}) => {
|
||||
if (!eventTypeId && !eventTypeSlug) {
|
||||
throw new HttpError({ statusCode: 400, message: "Either eventTypeId or eventTypeSlug must be provided" });
|
||||
}
|
||||
|
||||
// handle dynamic user
|
||||
const eventType =
|
||||
!eventTypeId && !!eventTypeSlug ? getDefaultEvent(eventTypeSlug) : await getEventTypesFromDB(eventTypeId);
|
||||
|
||||
Reference in new issue
Block a user