fix(get-user): apply shared khanegi nav sample to all tenants

Keep bottom menu at 4 slots so outdated per-tenant JSON cannot overflow the bar.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-24 11:42:44 +03:30
co-authored by Cursor
parent 065f8af8ed
commit abaacf5a99
2 changed files with 94 additions and 7 deletions
+12 -7
View File
@@ -1,6 +1,7 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { iranDaysUntil } from '../common/iran-time.util';
import { PrismaService } from '../prisma/prisma.service';
import { applyKhanegiNavSample } from './khanegi-nav-sample';
type UiSetting = { key: string; value: string };
@@ -318,10 +319,13 @@ export class GetUserService {
}
const navigation = app.navigation;
if (!navigation || typeof navigation !== 'object') return;
if (navigation.type === 'sidebar+bottom') navigation.type = 'both';
if (!navigation || typeof navigation !== 'object') {
app.navigation = { type: 'both' };
} else if (navigation.type === 'sidebar+bottom') {
navigation.type = 'both';
}
const nav = app.navigation;
const mapItems = (items: unknown) => {
if (!Array.isArray(items)) return items;
return items.map((item) => {
@@ -331,11 +335,12 @@ export class GetUserService {
});
};
navigation.sidebar = mapItems(navigation.sidebar);
navigation.bottom = mapItems(navigation.bottom);
if (navigation.sidebarReferral?.route === 'products') {
navigation.sidebarReferral.route = 'buyProduct';
nav.sidebar = mapItems(nav.sidebar);
nav.bottom = mapItems(nav.bottom);
if (nav.sidebarReferral?.route === 'products') {
nav.sidebarReferral.route = 'buyProduct';
}
applyKhanegiNavSample(nav);
}
private buildHamkarUiSettings(ui: Record<string, any>): UiSetting[] {