This commit is contained in:
payacom
2026-09-03 16:06:02 +03:30
parent 3f416a7a60
commit 90c5f94b57
31 changed files with 3968 additions and 4283 deletions

View File

@@ -19,6 +19,7 @@ const getPosts = async (req, res, next) => {
startDate,
endDate,
status,
user_id,
} = req.query;
const filter = {};
@@ -34,6 +35,12 @@ const getPosts = async (req, res, next) => {
if (status) {
filter.status = status;
}
// برای تبِ «پستها» توی جزئیاتِ کاربر (UserPosts.jsx پنل) — قبلاً ۱۰۰۰ تا پستِ
// سراسری می‌گرفت و سمتِ کلاینت فیلتر می‌کرد؛ اگه پست‌های این کاربر بینِ ۱۰۰۰ تای
// اخیر نمی‌بودن، این تب هیچی نشون نمی‌داد. فیلترِ user_id مستقیم به کوئری اضافه می‌شه
if (user_id && mongoose.Types.ObjectId.isValid(user_id)) {
filter.user_id = user_id;
}
const options = {
page: parseInt(page),