cal.pub0.org/packages/trpc/server/routers/viewer/organizations/deleteTeam.handler.ts

25 lines
480 B
TypeScript
Raw Normal View History

import { prisma } from "@calcom/prisma";
import type { TDeleteTeamInputSchema } from "./deleteTeam.schema";
type DeleteOptions = {
input: TDeleteTeamInputSchema;
};
export const deleteTeamHandler = async ({ input }: DeleteOptions) => {
// delete all memberships
await prisma.membership.deleteMany({
where: {
teamId: input.teamId,
},
});
await prisma.team.delete({
where: {
id: input.teamId,
},
});
};
export default deleteTeamHandler;