mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-11 16:58:28 +00:00
* Feat: add integrations access to OAuth apps * Fix: generalize OAuth flow --------- Co-authored-by: Manoj K <saimanoj58@gmail.com>
34 lines
886 B
TypeScript
34 lines
886 B
TypeScript
import { prisma } from "~/db.server";
|
|
|
|
/**
|
|
* Get all integration definitions available to a workspace.
|
|
* Returns both global (workspaceId: null) and workspace-specific definitions.
|
|
*/
|
|
export async function getIntegrationDefinitions(workspaceId?: string) {
|
|
return prisma.integrationDefinitionV2.findMany({
|
|
where: {
|
|
OR: [{ workspaceId: null }, ...(workspaceId ? [{ workspaceId }] : [])],
|
|
},
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Get a single integration definition by its ID.
|
|
*/
|
|
export async function getIntegrationDefinitionWithId(
|
|
integrationDefinitionId: string,
|
|
) {
|
|
return prisma.integrationDefinitionV2.findUnique({
|
|
where: { id: integrationDefinitionId },
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Get a single integration definition by its slug.
|
|
*/
|
|
export async function getIntegrationDefinitionWithSlug(slug: string) {
|
|
return prisma.integrationDefinitionV2.findFirst({
|
|
where: { slug },
|
|
});
|
|
}
|