shellphone.app/app/phone-calls/queries/get-phone-calls.ts
2021-08-06 01:14:19 +08:00

17 lines
442 B
TypeScript

import { resolver } from "blitz";
import { z } from "zod";
import db, { Prisma } from "db";
const Body = z.object({
phoneNumberId: z.string(),
});
export default resolver.pipe(resolver.zod(Body), resolver.authorize(), async ({ phoneNumberId }, context) => {
const organizationId = context.session.orgId;
return db.phoneCall.findMany({
where: { organizationId, phoneNumberId },
orderBy: { createdAt: Prisma.SortOrder.asc },
});
});