mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
29 lines
659 B
TypeScript
29 lines
659 B
TypeScript
import { TEAM_MEMBER_ROLE_PERMISSIONS_MAP } from '@documenso/lib/constants/teams';
|
|
import { prisma } from '@documenso/prisma';
|
|
|
|
import { buildTeamWhereQuery } from '../../utils/teams';
|
|
|
|
export type DeleteTeamEmailVerificationOptions = {
|
|
userId: number;
|
|
teamId: number;
|
|
};
|
|
|
|
export const deleteTeamEmailVerification = async ({
|
|
userId,
|
|
teamId,
|
|
}: DeleteTeamEmailVerificationOptions) => {
|
|
await prisma.team.findFirstOrThrow({
|
|
where: buildTeamWhereQuery({
|
|
teamId,
|
|
userId,
|
|
roles: TEAM_MEMBER_ROLE_PERMISSIONS_MAP['MANAGE_TEAM'],
|
|
}),
|
|
});
|
|
|
|
await prisma.teamEmailVerification.delete({
|
|
where: {
|
|
teamId,
|
|
},
|
|
});
|
|
};
|