diff --git a/fastify/app.js b/fastify/app.js index d171342..b0a104c 100755 --- a/fastify/app.js +++ b/fastify/app.js @@ -76,8 +76,6 @@ fastify.register(require("./feedback/server"), { pb }); fastify.register(require("./create-watchlist/server"), { pb }); fastify.register(require("./delete-watchlist/server"), { pb }); fastify.register(require("./edit-name-watchlist/server"), { pb }); -fastify.register(require("./get-notifications/server"), { pb }); -fastify.register(require("./update-notifications/server"), { pb }); fastify.register(require("./create-strategy/server"), { pb }); fastify.register(require("./delete-strategy/server"), { pb }); fastify.register(require("./all-strategies/server"), { pb }); diff --git a/fastify/get-notifications/server.js b/fastify/get-notifications/server.js deleted file mode 100755 index e6d017a..0000000 --- a/fastify/get-notifications/server.js +++ /dev/null @@ -1,30 +0,0 @@ -// Declare a route -module.exports = function (fastify, opts, done) { - - const pb = opts.pb; - - fastify.post('/get-notifications', async (request, reply) => { - const data = request.body; - - const userId = data?.userId; - let output; - - try { - output = await pb.collection("notifications").getFullList({ - filter: `opUser="${userId}" && readed = false`, - expand: 'user,post,comment', - sort: '-created' - }); - - } - catch(e) { - //console.log(e) - output = [] - } - - reply.send({ items: output }) - - }); - - done(); -}; \ No newline at end of file diff --git a/fastify/update-notifications/server.js b/fastify/update-notifications/server.js deleted file mode 100755 index e61f942..0000000 --- a/fastify/update-notifications/server.js +++ /dev/null @@ -1,29 +0,0 @@ -// Declare a route -module.exports = function (fastify, opts, done) { - - const pb = opts.pb; - - fastify.post('/update-notifications', async (request, reply) => { - const data = request.body; - - const notificationList = data?.unreadList; - let output; - - try { - const itemsToUpdate = notificationList?.filter(item => !item.readed); - // Perform updates in parallel - await Promise.all(itemsToUpdate.map(item => - pb.collection("notifications").update(item, { readed: 'true' }) - )); - - output = 'success' - } - catch(e) { - output = 'failure'; - } - - reply.send({ items: output }) - }); - - done(); -}; \ No newline at end of file