2022-10-13 18:30:48 +00:00
|
|
|
import type { NextApiRequest } from "next";
|
|
|
|
|
|
|
|
import { defaultResponder } from "@calcom/lib/server";
|
|
|
|
|
2022-11-25 13:56:58 +00:00
|
|
|
import { schemaEventTypeCustomInputPublic } from "~/lib/validations/event-type-custom-input";
|
|
|
|
import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransformParseInt";
|
2022-10-13 18:30:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @swagger
|
|
|
|
* /custom-inputs/{id}:
|
|
|
|
* get:
|
|
|
|
* summary: Find a eventTypeCustomInput
|
|
|
|
* parameters:
|
|
|
|
* - in: path
|
|
|
|
* name: id
|
|
|
|
* schema:
|
|
|
|
* type: integer
|
|
|
|
* required: true
|
|
|
|
* description: ID of the eventTypeCustomInput to get
|
|
|
|
* tags:
|
|
|
|
* - custom-inputs
|
|
|
|
* responses:
|
|
|
|
* 200:
|
|
|
|
* description: OK
|
|
|
|
* 401:
|
|
|
|
* description: Authorization information is missing or invalid.
|
|
|
|
* 404:
|
|
|
|
* description: EventType was not found
|
|
|
|
*/
|
|
|
|
export async function getHandler(req: NextApiRequest) {
|
|
|
|
const { prisma, query } = req;
|
|
|
|
const { id } = schemaQueryIdParseInt.parse(query);
|
|
|
|
const data = await prisma.eventTypeCustomInput.findUniqueOrThrow({ where: { id } });
|
|
|
|
return { event_type_custom_input: schemaEventTypeCustomInputPublic.parse(data) };
|
|
|
|
}
|
|
|
|
|
|
|
|
export default defaultResponder(getHandler);
|