From 9ee39eeb4b580f3f7864383cca60c7b5bf3283ae Mon Sep 17 00:00:00 2001 From: Xziy Date: Thu, 3 Oct 2024 02:37:19 +0300 Subject: [PATCH] build --- models/Group.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/models/Group.js b/models/Group.js index ee6c06db..d7c0cce2 100644 --- a/models/Group.js +++ b/models/Group.js @@ -228,7 +228,13 @@ let Model = { async getGroupBySlug(groupSlug) { if (!groupSlug) throw "groupSlug is required"; - const groupObj = await Group.findOne({ slug: groupSlug }); + let groupObj; + if (process.env.UNIQUE_SLUG) { + groupObj = await Group.findOne({ slug: groupSlug }); + } + else { + groupObj = await Group.find({ slug: groupSlug, isDeleted: false, visible: true }); + } if (!groupObj) { throw "group with slug " + groupSlug + " not found"; }