This commit is contained in:
Nikhil Nawgiri 2024-10-27 00:09:32 +02:00
parent 58c8682376
commit 738cd98618

View file

@ -16,6 +16,9 @@ const run = async () => {
}: JellyfinApiResponse = await fetchFromJellyfinApi();
const transformedItems = transformItems(items);
console.log("transformedItems:", transformedItems);
const arrayOfExistingImdbIds = transformedItems.map(item => item.imdbId);
console.log("arrayOfExistingImdbIds:", arrayOfExistingImdbIds);
// saveJsonToDisk({ totalItemCount, jellyfinItems: transformedItems });
@ -23,11 +26,18 @@ const run = async () => {
res.json(transformedItems)
});
app.post("/bob", (req, res) => {
const { imdbId } = req.body;
console.log("imdbId:", imdbId);
// to do: endpoint to check single items against arrayOfExistingImdbIds
res.send("OK\n");
app.post("/bob", (req, res) => {
const { imdbId: requestedImdbId } = req.body;
if (arrayOfExistingImdbIds.includes(requestedImdbId)) {
res.send("DUP\n");
} else {
// to do: push to wishlist array
// to do: save wishlist array to disk
res.send("OK\n");
}
})
app.listen(1312);