2023-05-24 01:01:31 +00:00
|
|
|
import { prisma } from "@calcom/prisma";
|
|
|
|
|
|
|
|
import type { TrpcSessionUser } from "../../../trpc";
|
|
|
|
import type { CheckGlobalKeysSchemaType } from "./checkGlobalKeys.schema";
|
|
|
|
|
|
|
|
type checkForGlobalKeys = {
|
|
|
|
ctx: {
|
|
|
|
user: NonNullable<TrpcSessionUser>;
|
|
|
|
};
|
|
|
|
input: CheckGlobalKeysSchemaType;
|
|
|
|
};
|
|
|
|
|
2023-08-25 11:48:24 +00:00
|
|
|
export const checkForGlobalKeysHandler = async ({ input }: checkForGlobalKeys) => {
|
2023-05-24 01:01:31 +00:00
|
|
|
const appIsGloballyInstalled = await prisma.app.findUnique({
|
|
|
|
where: {
|
|
|
|
slug: input.slug,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
return !!appIsGloballyInstalled;
|
|
|
|
};
|