File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
apps/app/src/jobs/tasks/scrape Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff 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." ,
You can’t perform that action at this time.
0 commit comments