464343f5ab
* WIP * WIP * Type and migration fixes * Adds missing default import * Fixes import * Fixes tRPC imports in App Store * Migrate stripe helpers * WIP * Type fixes * Type fix? * WIP * WIP * Update index.ts * Fixes * Update workflow.tsx * Moved queries to lib * Moves QueryCell * Migrates MultiSelectCheckboxes * WIP * CryptoSection type fixes * WIP * Import fixes * Build fixes * Update app-providers.tsx * Build fixes * Upgrades hookform zod resolvers * Build fixes * Cleanup * Build fixes * Relocates QueryCell to ui * Moved List and SkeletonLoader * Revert QueryCell migration * Can't use QueryCell here * oops * CryptoSection cleanup * Update app-providers.tsx * Moved ee to features * ee to features/ee * Removes @calcom/ee * Adds possible feature locations * Build fixes * Migrates stripe to app-store lib * Colocates stripe imports * Update subscription.ts * Submodule sync Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
72 lines
1.6 KiB
TypeScript
72 lines
1.6 KiB
TypeScript
import { Prisma } from "@prisma/client";
|
|
|
|
import prisma from "@calcom/prisma";
|
|
|
|
/**
|
|
* @deprecated
|
|
* DO NOT USE, since test run in parallel this will cause flaky tests. The reason
|
|
* being that a set of test may end earlier than other trigger a delete of all bookings
|
|
* than other tests may depend on them. The proper ettiquete should be that EACH test
|
|
* should cleanup ONLY the booking that we're created in that specific test to se DB
|
|
* remains "pristine" after each test
|
|
*/
|
|
export const deleteAllBookingsByEmail = async (
|
|
email: string,
|
|
whereConditional: Prisma.BookingWhereInput = {}
|
|
) =>
|
|
prisma.booking.deleteMany({
|
|
where: {
|
|
user: {
|
|
email,
|
|
},
|
|
...whereConditional,
|
|
},
|
|
});
|
|
|
|
export const deleteEventTypeByTitle = async (title: string) => {
|
|
const event = (await prisma.eventType.findFirst({
|
|
select: { id: true },
|
|
where: { title: title },
|
|
}))!;
|
|
await prisma.eventType.delete({ where: { id: event.id } });
|
|
};
|
|
|
|
export const deleteAllWebhooksByEmail = async (email: string) => {
|
|
await prisma.webhook.deleteMany({
|
|
where: {
|
|
user: {
|
|
email,
|
|
},
|
|
},
|
|
});
|
|
};
|
|
|
|
export const deleteAllPaymentsByEmail = async (email: string) => {
|
|
await prisma.payment.deleteMany({
|
|
where: {
|
|
booking: {
|
|
user: {
|
|
email,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
};
|
|
|
|
export const deleteAllPaymentCredentialsByEmail = async (email: string) => {
|
|
await prisma.user.update({
|
|
where: {
|
|
email,
|
|
},
|
|
data: {
|
|
credentials: {
|
|
deleteMany: {
|
|
type: {
|
|
endsWith: "_payment",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
};
|