
* WIP bookings page ui changes, created api endpoint * Ui changes mobile/desktop * Added translations * Fix lib import and common names * WIP reschedule * WIP * Save wip * [WIP] builder and class for CalendarEvent, email for attende * update rescheduled emails, booking view and availability page view * Working version reschedule * Fix for req.user as array * Added missing translation and refactor dialog to self component * Test for reschedule * update on types * Update lib no required * Update type on createBooking * fix types * remove preview stripe sub * remove unused file * remove unused import * Fix reschedule test * Refactor and cleaning up code * Email reschedule title fixes * Adding calendar delete and recreate placeholder of cancelled * Add translation * Removed logs, notes, fixed types * Fixes process.env types * Use strict compare * Fixes type inference * Type fixing is my middle name * Update apps/web/components/booking/BookingListItem.tsx * Update apps/web/components/dialog/RescheduleDialog.tsx * Update packages/core/builders/CalendarEvent/director.ts * Update apps/web/pages/success.tsx * Updates rescheduling labels * Update packages/core/builders/CalendarEvent/builder.ts * Type fixes * Update packages/core/builders/CalendarEvent/builder.ts * Only validating input blocked once * E2E fixes * Stripe tests fixes Co-authored-by: Peer Richelsen <peer@cal.com> Co-authored-by: zomars <zomars@me.com>
63 lines
1.2 KiB
TypeScript
63 lines
1.2 KiB
TypeScript
import { Prisma } from "@prisma/client";
|
|
|
|
import prisma from "@lib/prisma";
|
|
|
|
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",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
};
|