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

@@ -1,4 +1,12 @@
function computeVerifyBadge({ is_verified, license_verified, gold_badge }) {
const VERIFIED_BADGES = ['gold', 'green', 'blue']
// کاربر با تیک طلایی/سبز/آبی «وریفای‌شده» حساب می‌شه — محتواش نیازی به تاییدِ
// دستیِ پنل نداره و مستقیم توی اپ/وب نمایش داده می‌شه
function isVerifiedBadge (badge) {
return VERIFIED_BADGES.includes(badge)
}
function computeVerifyBadge ({ is_verified, license_verified, gold_badge }) {
if (gold_badge) return 'gold'
if (license_verified) return 'green'
if (is_verified === 'verified') return 'blue'
@@ -6,7 +14,7 @@ function computeVerifyBadge({ is_verified, license_verified, gold_badge }) {
return 'none'
}
function syncVerifyBadge(userDoc) {
function syncVerifyBadge (userDoc) {
userDoc.verify_badge = computeVerifyBadge({
is_verified: userDoc.is_verified,
license_verified: userDoc.license_verified,
@@ -15,4 +23,4 @@ function syncVerifyBadge(userDoc) {
return userDoc.verify_badge
}
module.exports = { computeVerifyBadge, syncVerifyBadge }
module.exports = { computeVerifyBadge, syncVerifyBadge, isVerifiedBadge, VERIFIED_BADGES }