Skip to content

Commit

Permalink
fix: hotfix hide hidden booking fields in event-types GET / (#18306)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThyMinimalDev authored Dec 20, 2024
1 parent cafa3f9 commit ca3e7bd
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
UpdateEventTypeInput_2024_06_14,
GetEventTypesQuery_2024_06_14,
CreateEventTypeInput_2024_06_14,
EventTypeOutput_2024_06_14,
} from "@calcom/platform-types";

@Controller({
Expand Down Expand Up @@ -113,10 +114,26 @@ export class EventTypesController_2024_06_14 {
@Query() queryParams: GetEventTypesQuery_2024_06_14
): Promise<GetEventTypesOutput_2024_06_14> {
const eventTypes = await this.eventTypesService.getEventTypes(queryParams);
const eventTypesFormatted = this.eventTypeResponseTransformPipe.transform(eventTypes);
const eventTypesWithoutHiddenFields = eventTypesFormatted.map((eventType) => {
return {
...eventType,
bookingFields: Array.isArray(eventType?.bookingFields)
? eventType?.bookingFields
.map((field) => {
if ("hidden" in field) {
return field.hidden !== true ? field : null;
}
return field;
})
.filter((f) => f)
: [],
};
}) as EventTypeOutput_2024_06_14[];

return {
status: SUCCESS_STATUS,
data: this.eventTypeResponseTransformPipe.transform(eventTypes),
data: eventTypesWithoutHiddenFields,
};
}

Expand Down

0 comments on commit ca3e7bd

Please sign in to comment.