Skip to content

Commit 38e11d9

Browse files
authored
Merge pull request #777 from trycompai/lewis/vendor-research-tweaks
[dev] [carhartlewis] lewis/vendor-research-tweaks
2 parents c100119 + bda621b commit 38e11d9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

apps/app/src/jobs/tasks/scrape/research.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,28 @@ export const researchVendor = schemaTask({
4040
}),
4141
maxDuration: 1000 * 60 * 10, // 10 minutes total task duration
4242
run: async (payload, { ctx }) => {
43+
// Check if vendor already exists
44+
const existingVendor = await db.globalVendors.findFirst({
45+
where: {
46+
OR: [
47+
{ website: payload.website },
48+
{
49+
company_name: {
50+
equals: payload.website,
51+
mode: "insensitive",
52+
},
53+
},
54+
],
55+
},
56+
});
57+
58+
if (existingVendor) {
59+
return {
60+
message: "Vendor already exists in database",
61+
existingVendor,
62+
};
63+
}
64+
4365
return researchJobCore({
4466
website: payload.website,
4567
prompt: "You're a cyber security researcher, researching a vendor.",

0 commit comments

Comments
 (0)