23 lines
707 B
JavaScript
23 lines
707 B
JavaScript
import { prisma } from "../db.js";
|
|
export default async function processEntries(feedId, parsed) {
|
|
for (const item of parsed.items) {
|
|
await prisma.entry.upsert({
|
|
where: {
|
|
guid_feedId: {
|
|
guid: item.guid || item.link,
|
|
feedId
|
|
}
|
|
},
|
|
update: {},
|
|
create: {
|
|
feedId,
|
|
guid: item.guid || item.link,
|
|
title: item.title || "Untitled",
|
|
link: item.link,
|
|
content: item.contentSnippet || item.content || "",
|
|
published: item.isoDate ? new Date(item.isoDate) : null
|
|
}
|
|
});
|
|
}
|
|
}
|