chore: Cleanup Close.com (#16929)
This commit is contained in:
1 parent
81386d4ec0
commit
02cecd6707
19 files changed
+7
-391
No files matched your search
@@ -11,8 +11,6 @@ import { getLocaleFromRequest } from "@calcom/lib/getLocaleFromRequest";
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { usernameHandler, type RequestWithUsernameStatus } from "@calcom/lib/server/username";
|
||||
import { createWebUser as syncServicesCreateWebUser } from "@calcom/lib/sync/SyncServiceManager";
|
||||
import { closeComUpsertTeamUser } from "@calcom/lib/sync/SyncServiceManager";
|
||||
import { validateAndGetCorrectedUsernameAndEmail } from "@calcom/lib/validateUsername";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import { IdentityProvider } from "@calcom/prisma/enums";
|
||||
@@ -172,8 +170,6 @@ async function handler(req: RequestWithUsernameStatus, res: NextApiResponse) {
|
||||
team,
|
||||
});
|
||||
|
||||
closeComUpsertTeamUser(team, user, membership.role);
|
||||
|
||||
// Accept any child team invites for orgs.
|
||||
if (team.parent) {
|
||||
await joinAnyChildTeamOnOrgInvite({
|
||||
@@ -210,8 +206,6 @@ async function handler(req: RequestWithUsernameStatus, res: NextApiResponse) {
|
||||
language: await getLocaleFromRequest(req),
|
||||
username: username || "",
|
||||
});
|
||||
// Sync Services
|
||||
await syncServicesCreateWebUser(user);
|
||||
}
|
||||
|
||||
if (checkoutSessionId) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import { IS_PREMIUM_USERNAME_ENABLED } from "@calcom/lib/constants";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { isUsernameReservedDueToMigration } from "@calcom/lib/server/username";
|
||||
import slugify from "@calcom/lib/slugify";
|
||||
import { closeComUpsertTeamUser } from "@calcom/lib/sync/SyncServiceManager";
|
||||
import { validateAndGetCorrectedUsernameAndEmail } from "@calcom/lib/validateUsername";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { IdentityProvider } from "@calcom/prisma/enums";
|
||||
@@ -118,8 +117,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
team,
|
||||
});
|
||||
|
||||
closeComUpsertTeamUser(team, user, membership.role);
|
||||
|
||||
// Accept any child team invites for orgs.
|
||||
if (team.parent) {
|
||||
await joinAnyChildTeamOnOrgInvite({
|
||||
|
||||
@@ -8,9 +8,9 @@ import { v5 as uuidv5 } from "uuid";
|
||||
import processExternalId from "@calcom/app-store/_utils/calendars/processExternalId";
|
||||
import { metadata as GoogleMeetMetadata } from "@calcom/app-store/googlevideo/_metadata";
|
||||
import {
|
||||
getLocationValueForDB,
|
||||
MeetLocationType,
|
||||
OrganizerDefaultConferencingAppType,
|
||||
getLocationValueForDB,
|
||||
} from "@calcom/app-store/locations";
|
||||
import { DailyLocationType } from "@calcom/app-store/locations";
|
||||
import { getAppFromSlug } from "@calcom/app-store/utils";
|
||||
@@ -60,7 +60,6 @@ import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
import { DistributionMethod, getLuckyUser } from "@calcom/lib/server/getLuckyUser";
|
||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import { WorkflowRepository } from "@calcom/lib/server/repository/workflow";
|
||||
import { updateWebUser as syncServicesUpdateWebUser } from "@calcom/lib/sync/SyncServiceManager";
|
||||
import { getTimeFormatStringFromUserTimeFormat } from "@calcom/lib/timeFormat";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { BookingStatus, SchedulingType, WebhookTriggerEvents } from "@calcom/prisma/enums";
|
||||
@@ -91,11 +90,11 @@ import { handleAppsStatus } from "./handleNewBooking/handleAppsStatus";
|
||||
import { loadAndValidateUsers } from "./handleNewBooking/loadAndValidateUsers";
|
||||
import { scheduleNoShowTriggers } from "./handleNewBooking/scheduleNoShowTriggers";
|
||||
import type {
|
||||
Invitee,
|
||||
IEventTypePaymentCredentialType,
|
||||
IsFixedAwareUser,
|
||||
BookingType,
|
||||
Booking,
|
||||
BookingType,
|
||||
IEventTypePaymentCredentialType,
|
||||
Invitee,
|
||||
IsFixedAwareUser,
|
||||
} from "./handleNewBooking/types";
|
||||
import { validateBookingTimeIsNotOutOfBounds } from "./handleNewBooking/validateBookingTimeIsNotOutOfBounds";
|
||||
import { validateEventLength } from "./handleNewBooking/validateEventLength";
|
||||
@@ -962,14 +961,6 @@ async function handler(
|
||||
originalRescheduledBooking,
|
||||
});
|
||||
|
||||
// @NOTE: Add specific try catch for all subsequent async calls to avoid error
|
||||
// Sync Services
|
||||
await syncServicesUpdateWebUser(
|
||||
await prisma.user.findFirst({
|
||||
where: { id: userId },
|
||||
select: { id: true, email: true, name: true, username: true, createdDate: true },
|
||||
})
|
||||
);
|
||||
evt.uid = booking?.uid ?? null;
|
||||
evt.oneTimePassword = booking?.oneTimePassword ?? null;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import stripe from "@calcom/features/ee/payments/server/stripe";
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
import { defaultHandler, defaultResponder } from "@calcom/lib/server";
|
||||
import { closeComUpdateTeam } from "@calcom/lib/sync/SyncServiceManager";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { teamMetadataSchema } from "@calcom/prisma/zod-utils";
|
||||
|
||||
@@ -66,9 +65,6 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
return res.status(statusCode).json({ message });
|
||||
}
|
||||
}
|
||||
|
||||
// Sync Services: Close.com
|
||||
closeComUpdateTeam(prevTeam, team);
|
||||
}
|
||||
|
||||
if (!metadata) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { User } from "@prisma/client";
|
||||
|
||||
import { deleteStripeCustomer } from "@calcom/app-store/stripepayment/lib/customer";
|
||||
import { deleteWebUser as syncServicesDeleteWebUser } from "@calcom/lib/sync/SyncServiceManager";
|
||||
import prisma from "@calcom/prisma";
|
||||
|
||||
export async function deleteUser(user: Pick<User, "id" | "email" | "metadata">) {
|
||||
@@ -9,12 +8,9 @@ export async function deleteUser(user: Pick<User, "id" | "email" | "metadata">)
|
||||
await deleteStripeCustomer(user).catch(console.warn);
|
||||
// Remove my account
|
||||
// TODO: Move this to Repository pattern.
|
||||
const deletedUser = await prisma.user.delete({
|
||||
await prisma.user.delete({
|
||||
where: {
|
||||
id: user.id,
|
||||
},
|
||||
});
|
||||
|
||||
// Sync Services
|
||||
syncServicesDeleteWebUser(deletedUser);
|
||||
}
|
||||
Reference in new issue
Block a user