* refactor: V2 API endpoint create phone call * fix: type err * fix: type and build err * chore: change default value * chore: move it to another route * test: for create phone call * chore: undo constant * chore: remove test * fix: make begin_message optional * chore: improvements * chore: begin message * chore: remove unused import * chore: bump platform libraries with handleCreatePhoneCall * chore: improvement --------- Co-authored-by: Keith Williams <keithwillcode@gmail.com> Co-authored-by: Benny Joo <sldisek783@gmail.com> Co-authored-by: Morgan Vernay <morgan@cal.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com>
28 lines
813 B
TypeScript
28 lines
813 B
TypeScript
import type { z } from "zod";
|
|
|
|
import type { createPhoneCallSchema } from "@calcom/features/ee/cal-ai-phone/zod-utils";
|
|
import { handleCreatePhoneCall } from "@calcom/features/handleCreatePhoneCall";
|
|
import type { PrismaClient } from "@calcom/prisma";
|
|
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
|
|
|
|
type CreatePhoneCallProps = {
|
|
ctx: {
|
|
user: NonNullable<TrpcSessionUser>;
|
|
prisma: PrismaClient;
|
|
};
|
|
input: z.infer<typeof createPhoneCallSchema>;
|
|
};
|
|
|
|
const createPhoneCallHandler = async ({ input, ctx }: CreatePhoneCallProps) => {
|
|
return await handleCreatePhoneCall({
|
|
user: {
|
|
id: ctx.user.id,
|
|
timeZone: ctx.user.timeZone,
|
|
profile: { organization: { id: ctx.user.profile.organization?.id } },
|
|
},
|
|
input,
|
|
});
|
|
};
|
|
|
|
export default createPhoneCallHandler;
|