fix: build webhooks and event-types

This commit is contained in:
Agusti Fernandez Pardo committed 2022-05-20 00:58:42 +02:00
1 parent 2e8f42c5d7
commit f2ce2f324b
6 files changed
+188 -187

No files matched your search

+13 -11
View File
@@ -1,19 +1,21 @@
import type { IncomingMessage } from "http";
// import type { NextApiRequest } from "next";
import { NextMiddleware } from "next-api-middleware";
import { hashAPIKey } from "@calcom/ee/lib/api/apiKeys";
import prisma from "@calcom/prisma";
/** @todo figure how to use the one from `@calcom/types`fi */
/** @todo: remove once `@calcom/types` is updated with it.*/
declare module "next" {
export interface NextApiRequest extends IncomingMessage {
userId: number;
query: {
apiKey: string;
};
}
}
// /** @todo figure how to use the one from `@calcom/types`fi */
// /** @todo: remove once `@calcom/types` is updated with it.*/
// declare module "next" {
// export interface NextApiRequest extends NextApiRequest {
// userId: number;
// body: any;
// method: string;
// query: {
// apiKey: string;
// };
// }
// }
// Used to check if the apiKey is not expired, could be extracted if reused. but not for now.
export const dateNotInPast = function (date: Date) {
+1
View File
@@ -150,6 +150,7 @@ interface EventTypeExtended extends Omit<EventType, "recurringEvent" | "location
type: DefaultLocationType | AppStoreLocationType;
}[];
}
// EventType
export type EventTypeResponse = BaseResponse & {
event_type?: Partial<EventTypeExtended>;
+1 -1
View File
@@ -24,7 +24,7 @@ export const schemaWebhookCreateBodyParams = schemaWebhookBaseBodyParams.merge(s
const schemaWebhookEditParams = z
.object({
payloadTemplate: z.string().optional(),
eventTriggers: z.string().optional(),
eventTriggers: z.any(),
subscriberUrl: z.string().optional(),
})
.strict();