From 61861233fdb20913a9580931aa0e371b77bf39e1 Mon Sep 17 00:00:00 2001 From: batuhancoskun Date: Sun, 15 Jun 2025 02:28:04 +0300 Subject: [PATCH] =?UTF-8?q?Girdilere=20saya=C3=A7=20eklendi.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/blogs/middlewares/query.js | 12 +++++++----- modules/notifications/middlewares/proccess.js | 13 +++++++------ modules/notifications/middlewares/queryProccess.js | 6 ++---- modules/users/routes/home.js | 8 +++++++- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/modules/blogs/middlewares/query.js b/modules/blogs/middlewares/query.js index a003b45..c0c81ae 100644 --- a/modules/blogs/middlewares/query.js +++ b/modules/blogs/middlewares/query.js @@ -364,11 +364,13 @@ exports.getBlogsForDiscover = async function({userId, endDate, blogIds = false}) userId: userId }); + followsIds.push(userId); + const blogs = await Blogs.findAll({ where:[{ - [Op.not]: { - userId: [followsIds, userId] - } + [Op.not]: [{ + userId: followsIds + }] }, (endDate) ? { createdAt: { [Op.lt]: endDate @@ -439,12 +441,12 @@ exports.getBlogsForDiscoverWithCategory = async function({userId, category, endD userId: userId }); - console.log(endDate, blogIds); + followsIds.push(userId); const blogs = await Blogs.findAll({ where:[{ [Op.not]: { - userId: [followsIds, userId] + userId: followsIds } }, (endDate) && { createdAt: { diff --git a/modules/notifications/middlewares/proccess.js b/modules/notifications/middlewares/proccess.js index dff1796..ebf593e 100644 --- a/modules/notifications/middlewares/proccess.js +++ b/modules/notifications/middlewares/proccess.js @@ -1,12 +1,13 @@ const { Notifications } = require("../models/Notifications"); exports.createNotification = async function({data, userId, notificationCodeId}) { - // console.log(userId, notificationDraftId, data); - return await Notifications.create({ - data: data, - userId: userId, - notificationCodeId: notificationCodeId - }); + if(userId !== data.user){ + return await Notifications.create({ + data: data, + userId: userId, + notificationCodeId: notificationCodeId + }); + } }; exports.readedNotification = async function({notificationId}){ diff --git a/modules/notifications/middlewares/queryProccess.js b/modules/notifications/middlewares/queryProccess.js index 80cbea5..0e4adf3 100644 --- a/modules/notifications/middlewares/queryProccess.js +++ b/modules/notifications/middlewares/queryProccess.js @@ -14,7 +14,7 @@ exports.repairNotifications = async function(data){ code: notification.notificationCode.code, datetime: new Object() }); - + rslt.blog = await getBlog({blogId: datas.blog}).then(res => { if(res){ return { @@ -27,8 +27,6 @@ exports.repairNotifications = async function(data){ } }); - console.log(56); - rslt.user = await getUserWithId({userId: datas.user}).then(res => { return { name: `${res.first_name} ${res.second_name}`, @@ -41,6 +39,6 @@ exports.repairNotifications = async function(data){ result.push(rslt); }; - + return result; }; \ No newline at end of file diff --git a/modules/users/routes/home.js b/modules/users/routes/home.js index 5ee60c2..c2b6422 100644 --- a/modules/users/routes/home.js +++ b/modules/users/routes/home.js @@ -12,7 +12,13 @@ router.get("/get/peoples", auth, async (req, res) => { router.get("/get/user/my", auth, async (req, res) => { try { res.json({ - user: await getUserWithId({userId: req.session.user.id}) + user: await getUserWithId({userId: req.session.user.id}), + config: { + min_title: process.env.BLOGS_MIN_LIMIT_TITLE, + max_title: process.env.BLOGS_MAX_LIMIT_TITLE, + min_text: process.env.BLOGS_MIN_LIMIT_TEXT, + max_text: process.env.BLOGS_MAX_LIMIT_TEXT + } }); } catch (error) { };