mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-11 17:08:27 +00:00
* Feat: added integration connect and mcp oAuth * Feat: add mcp support to chat * Fix: UI for integrations and logs * Fix: ui * Fix: proxy server * Feat: enhance MCP tool integration and loading functionality * Fix: added header * Fix: Linear integration sync --------- Co-authored-by: Manoj K <saimanoj58@gmail.com>
57 lines
972 B
TypeScript
57 lines
972 B
TypeScript
import { prisma } from "~/db.server";
|
|
|
|
export async function getIngestionRuleBySource(
|
|
source: string,
|
|
workspaceId: string,
|
|
) {
|
|
return await prisma.ingestionRule.findFirst({
|
|
where: {
|
|
source,
|
|
workspaceId,
|
|
},
|
|
});
|
|
}
|
|
|
|
// Need to fix this later
|
|
export async function upsertIngestionRule({
|
|
text,
|
|
source,
|
|
workspaceId,
|
|
userId,
|
|
}: {
|
|
text: string;
|
|
source: string;
|
|
workspaceId: string;
|
|
userId: string;
|
|
}) {
|
|
// Find existing rule first
|
|
const existingRule = await prisma.ingestionRule.findFirst({
|
|
where: {
|
|
source,
|
|
workspaceId,
|
|
},
|
|
});
|
|
|
|
if (existingRule) {
|
|
// Update existing rule
|
|
return await prisma.ingestionRule.update({
|
|
where: {
|
|
id: existingRule.id,
|
|
},
|
|
data: {
|
|
text,
|
|
},
|
|
});
|
|
} else {
|
|
// Create new rule
|
|
return await prisma.ingestionRule.create({
|
|
data: {
|
|
text,
|
|
source,
|
|
workspaceId,
|
|
userId,
|
|
},
|
|
});
|
|
}
|
|
}
|