core/apps/webapp/app/services/ingestionRule.server.ts
Harshith Mullapudi 038acea669
Feat: added integration connect and mcp oAuth (#20)
* 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>
2025-07-17 12:41:32 +05:30

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,
},
});
}
}