Files
calendar/packages/trpc/server/routers/viewer/phoneNumber/list.handler.ts
T
deca7ce40a refactor: move calAIPhone-specific repositories to features from lib (#25840)
* add prisma agent repository to features

* add

* wip

* wip

* wip

* Update apps/web/app/api/webhooks/retell-ai/route.ts

Co-authored-by: Volnei Munhoz <volnei@cal.com>

* ts fix

* ts fix

---------

Co-authored-by: Volnei Munhoz <volnei@cal.com>
2025-12-15 13:43:24 +05:30

22 lines
671 B
TypeScript

import { PrismaPhoneNumberRepository } from "@calcom/features/calAIPhone/repositories/PrismaPhoneNumberRepository";
import prisma from "@calcom/prisma";
import type { TrpcSessionUser } from "../../../types";
import type { TListInputSchema } from "./list.schema";
type ListHandlerOptions = {
ctx: {
user: NonNullable<TrpcSessionUser>;
};
input: TListInputSchema;
};
export const listHandler = async ({ ctx, input }: ListHandlerOptions) => {
const phoneNumberRepo = new PrismaPhoneNumberRepository(prisma);
return await phoneNumberRepo.findManyWithUserAccess({
userId: ctx.user.id,
teamId: input?.teamId,
scope: input?.scope || "all",
});
};