fix: Remove credentials and some ts fixes (#11794)
parent
778485b31d
commit
150dc3acb9
|
@ -1,6 +1,6 @@
|
|||
import type { Prisma } from "@prisma/client";
|
||||
import type { TFunction } from "next-i18next";
|
||||
|
||||
import type { CredentialDataWithTeamName } from "@calcom/app-store/utils";
|
||||
import { defaultVideoAppCategories } from "@calcom/app-store/utils";
|
||||
import getEnabledAppsFromCredentials from "@calcom/lib/apps/getEnabledAppsFromCredentials";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
|
@ -21,11 +21,11 @@ export async function getLocationGroupedOptions(
|
|||
disabled?: boolean;
|
||||
icon?: string;
|
||||
slug?: string;
|
||||
credential?: CredentialDataWithTeamName;
|
||||
}[]
|
||||
> = {};
|
||||
|
||||
let idToSearchObject = {};
|
||||
// don't default to {}, when you do TS no longer determines the right types.
|
||||
let idToSearchObject: Prisma.CredentialWhereInput;
|
||||
|
||||
if ("teamId" in userOrTeamId) {
|
||||
const teamId = userOrTeamId.teamId;
|
||||
|
@ -84,11 +84,11 @@ export async function getLocationGroupedOptions(
|
|||
: app.categories[0] || app.category;
|
||||
if (!groupByCategory) groupByCategory = AppCategories.conferencing;
|
||||
|
||||
for (const credential of app.credentials) {
|
||||
const label = `${app.locationOption.label} ${
|
||||
credential.team?.name ? `(${credential.team.name})` : ""
|
||||
}`;
|
||||
const option = { ...app.locationOption, label, icon: app.logo, slug: app.slug, credential };
|
||||
for (const { teamName } of app.credentials.map((credential) => ({
|
||||
teamName: credential.team?.name,
|
||||
}))) {
|
||||
const label = `${app.locationOption.label} ${teamName ? `(${teamName})` : ""}`;
|
||||
const option = { ...app.locationOption, label, icon: app.logo, slug: app.slug };
|
||||
if (apps[groupByCategory]) {
|
||||
apps[groupByCategory] = [...apps[groupByCategory], option];
|
||||
} else {
|
||||
|
|
|
@ -11,7 +11,7 @@ import { CAL_URL } from "@calcom/lib/constants";
|
|||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import type { Credential } from "@calcom/prisma/client";
|
||||
import { SchedulingType, MembershipRole, AppCategories } from "@calcom/prisma/enums";
|
||||
import { SchedulingType, MembershipRole } from "@calcom/prisma/enums";
|
||||
import { customInputSchema, EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
@ -230,27 +230,6 @@ export default async function getEventTypeById({
|
|||
}
|
||||
}
|
||||
|
||||
const credentials = await prisma.credential.findMany({
|
||||
where: {
|
||||
userId,
|
||||
app: {
|
||||
enabled: true,
|
||||
categories: {
|
||||
hasSome: [AppCategories.conferencing, AppCategories.video, AppCategories.payment],
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
type: true,
|
||||
key: true,
|
||||
userId: true,
|
||||
teamId: true,
|
||||
appId: true,
|
||||
invalid: true,
|
||||
},
|
||||
});
|
||||
|
||||
const { locations, metadata, ...restEventType } = rawEventType;
|
||||
const newMetadata = EventTypeMetaDataSchema.parse(metadata || {}) || {};
|
||||
const apps = newMetadata?.apps || {};
|
||||
|
|
Loading…
Reference in New Issue