Skip to content

Scheduling infrastructure for absolutely everyone.

Adds custom inputs to eventTypes responses

zomars25d3d123199a
diff --git a/lib/validations/event-type.ts b/lib/validations/event-type.ts
index 462990d65e7..ce168925d09 100644
--- a/lib/validations/event-type.ts
+++ b/lib/validations/event-type.ts
@@ -1,6 +1,6 @@
import { z } from "zod";
-import { _EventTypeModel as EventType } from "@calcom/prisma/zod";
+import { _EventTypeCustomInputModel, _EventTypeModel as EventType } from "@calcom/prisma/zod";
import { Frequency } from "@lib/types";
@@ -116,5 +116,6 @@ export const schemaEventTypeReadPublic = EventType.pick({
)
.nullable(),
metadata: jsonSchema.nullable(),
+ customInputs: _EventTypeCustomInputModel.array().optional(),
})
);
diff --git a/pages/api/event-types/[id]/_get.ts b/pages/api/event-types/[id]/_get.ts
index 13301a9f38b..5ce12e2c86d 100644
--- a/pages/api/event-types/[id]/_get.ts
+++ b/pages/api/event-types/[id]/_get.ts
@@ -36,7 +36,7 @@ import { schemaQueryIdParseInt } from "@lib/validations/shared/queryIdTransformP
export async function getHandler(req: NextApiRequest) {
const { prisma, query } = req;
const { id } = schemaQueryIdParseInt.parse(query);
- const event_type = await prisma.eventType.findUnique({ where: { id } });
+ const event_type = await prisma.eventType.findUnique({ where: { id }, include: { customInputs: true } });
return { event_type: schemaEventTypeReadPublic.parse(event_type) };
}
diff --git a/pages/api/event-types/_get.ts b/pages/api/event-types/_get.ts
index 3a3b968b8b7..b126da8a28f 100644
--- a/pages/api/event-types/_get.ts
+++ b/pages/api/event-types/_get.ts
@@ -27,7 +27,9 @@ import { schemaQuerySingleOrMultipleUserIds } from "@lib/validations/shared/quer
*/
async function getHandler(req: NextApiRequest) {
const { userId, isAdmin, prisma } = req;
- const args: Prisma.EventTypeFindManyArgs = isAdmin ? {} : { where: { userId } };
+ const args: Prisma.EventTypeFindManyArgs = isAdmin
+ ? {}
+ : { where: { userId }, include: { customInputs: true } };
/** Only admins can query other users */
if (!isAdmin && req.query.userId) throw new HttpError({ statusCode: 401, message: "ADMIN required" });
if (isAdmin && req.query.userId) {