Add Khanegi uiVariant modular/newTheme with get_user payload split.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-09 12:58:45 +03:30
co-authored by Cursor
parent 2f0e39edbb
commit 1adaef5d18
5 changed files with 46 additions and 5 deletions
+12 -4
View File
@@ -43,19 +43,23 @@ export class GetUserService {
? registryMode
: 'dynamicMode'
const isKhanegi = tenant.product === 'khanegi';
const uiVariant =
isKhanegi && tenant.uiVariant === 'newTheme' ? 'newTheme' : 'modular';
const color =
hamkarBrand?.primaryColor ||
khanegiColors?.primary ||
(uiVariant === 'newTheme' ? khanegiColors?.primary : null) ||
tenant.primaryColor ||
null
const secondary =
hamkarBrand?.secondaryColor ||
khanegiColors?.secondary ||
(uiVariant === 'newTheme' ? khanegiColors?.secondary : null) ||
tenant.secondaryColor ||
null
const background =
hamkarBrand?.backgroundColor ||
khanegiColors?.background ||
(uiVariant === 'newTheme' ? khanegiColors?.background : null) ||
tenant.backgroundColor ||
null
@@ -75,8 +79,12 @@ export class GetUserService {
product: tenant.product,
theme: themeMode,
mode: themeMode,
/** Khanegi front-end family for consumers */
ui_variant: isKhanegi ? uiVariant : undefined,
app_ui_config:
tenant.product === 'khanegi' ? this.stripKhanegiSaMeta(ui) : undefined,
isKhanegi && uiVariant === 'newTheme'
? this.stripKhanegiSaMeta(ui)
: undefined,
/** Laravel-compatible overlay; Hamkar merges only when present */
ui_settings: uiSettings.length ? uiSettings : undefined,
};
+6 -1
View File
@@ -8,7 +8,7 @@ import {
MaxLength,
MinLength,
} from 'class-validator';
import { ProductType } from '@prisma/client';
import { KhanegiUiVariant, ProductType } from '@prisma/client';
export class CreateTenantDto {
@IsEnum(ProductType)
@@ -80,6 +80,11 @@ export class CreateTenantDto {
@IsObject()
appUiConfig?: Record<string, unknown>;
/** Khanegi only; default modular. */
@IsOptional()
@IsEnum(KhanegiUiVariant)
uiVariant?: KhanegiUiVariant;
@IsOptional()
@IsString()
@MaxLength(64)
+6
View File
@@ -38,6 +38,7 @@ export class TenantsService {
appUrl: true,
adminUrl: true,
appUiConfig: true,
uiVariant: true,
appVersion: true,
isActive: true,
notes: true,
@@ -81,6 +82,10 @@ export class TenantsService {
appUiConfig: dto.appUiConfig
? (dto.appUiConfig as Prisma.InputJsonValue)
: undefined,
uiVariant:
dto.product === ProductType.khanegi
? dto.uiVariant ?? 'modular'
: 'modular',
appVersion: dto.appVersion?.trim() || '1',
isActive: dto.isActive ?? true,
notes: dto.notes,
@@ -144,6 +149,7 @@ export class TenantsService {
...(dto.appUiConfig !== undefined && {
appUiConfig: dto.appUiConfig as Prisma.InputJsonValue,
}),
...(dto.uiVariant !== undefined && { uiVariant: dto.uiVariant }),
...(dto.appVersion !== undefined && {
appVersion: dto.appVersion.trim() || '1',
}),