fix: Remove credentials and some ts fixes (#11794)

This commit is contained in:
Alex van Andel authored and GitHub committed 2023-10-10 10:08:06 -07:00
1 parent 778485b31d
commit 150dc3acb9
2 files changed
+9 -30

No files matched your search

+8 -8
View File
@@ -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 {