Initial commit

This commit is contained in:
payacom
2026-07-08 21:01:30 +03:30
parent 59c7c8e11c
commit 0b01b262fa
38 changed files with 1415 additions and 288 deletions

View File

@@ -2,6 +2,10 @@ const MessageModel = require('../../../models/MessageModel')
const UserModel = require('../../../models/UserModel')
const jwt = require('jsonwebtoken')
const moment = require('moment-jalaali')
const {
viewerBlockedUser,
userBlockedViewer,
} = require('../../../utils/blockVisibility')
const getMessages = async (req, res, next) => {
try {
const token = req.header('Authorization').split(' ')[1]
@@ -74,8 +78,8 @@ const getMessages = async (req, res, next) => {
}
// بررسی آیا کاربر فعلی در لیست بلاک‌شده‌های این کاربر است یا خیر
const blockedByCurrentUser = user.blocked_by.includes(userId)
const blockedYou = user.blocked_users.includes(userId)
const blockedByCurrentUser = viewerBlockedUser(user, userId)
const blockedYou = userBlockedViewer(user, userId)
return {
first_name: user.first_name,