This commit is contained in:
2026-02-04 01:05:00 +00:00
parent f9222627ef
commit d02d95e680
30 changed files with 2449 additions and 326 deletions

View File

@@ -122,6 +122,28 @@ export const upsertBatch = mutation({
});
created += 1;
}
const seenExisting = await ctx.db
.query("seenUrls")
.withIndex("by_project_url", (q) =>
q.eq("projectId", args.projectId).eq("url", opp.url)
)
.first();
if (seenExisting) {
await ctx.db.patch(seenExisting._id, {
lastSeenAt: now,
source: "opportunities",
});
} else {
await ctx.db.insert("seenUrls", {
projectId: args.projectId,
url: opp.url,
firstSeenAt: now,
lastSeenAt: now,
source: "opportunities",
});
}
}
return { created, updated };