mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-11 17:08:27 +00:00
1. Created Integrations page with grid view of integration cards 2. Implemented category filter dropdown 3. Added integration details modal dialog 4. Implemented API key and OAuth authentication flows 5. Created API endpoint for direct integration account creation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
import { prisma } from "~/db.server";
|
|
|
|
export const getIntegrationAccount = async (
|
|
integrationDefinitionId: string,
|
|
userId: string,
|
|
) => {
|
|
return await prisma.integrationAccount.findFirst({
|
|
where: {
|
|
integrationDefinitionId: integrationDefinitionId,
|
|
integratedById: userId,
|
|
isActive: true,
|
|
},
|
|
});
|
|
};
|
|
|
|
export const createIntegrationAccount = async ({
|
|
integrationDefinitionId,
|
|
userId,
|
|
accountId,
|
|
config,
|
|
settings,
|
|
}: {
|
|
integrationDefinitionId: string;
|
|
userId: string;
|
|
accountId: string;
|
|
config?: Record<string, any>;
|
|
settings?: Record<string, any>;
|
|
}) => {
|
|
return prisma.integrationAccount.create({
|
|
data: {
|
|
accountId,
|
|
integrationDefinitionId,
|
|
integratedById: userId,
|
|
config: config || {},
|
|
settings: settings || {},
|
|
isActive: true,
|
|
},
|
|
});
|
|
};
|
|
|
|
export const getIntegrationAccounts = async (userId: string) => {
|
|
return prisma.integrationAccount.findMany({
|
|
where: {
|
|
integratedById: userId,
|
|
isActive: true,
|
|
},
|
|
include: {
|
|
integrationDefinition: true,
|
|
},
|
|
});
|
|
};
|