feat(settings): unify settings and ui-texts with canonical aliases, add PriceInput thousand separators, and synchronize financial endpoints
Deploy Canina / deploy (push) Successful in 1m46s

This commit is contained in:
parsa aghaei committed 2026-08-17 09:57:23 +03:30
1 parent 45c9db133c
commit b3c60a1a7d
17 files changed
+79340 -78724

No files matched your search

+26 -1
View File
@@ -10,6 +10,7 @@ import { RedisService } from '../redis/redis.service';
import * as bcrypt from 'bcryptjs';
import { CreateUserDto, UpdateUserDto } from './dto/user.dto';
import { normalizeMobile } from '../common/utils/phone.utils';
import { CANONICAL_ALIASES } from '../settings/settings.service';
export class PaginationQuery {
page?: number | string;
@@ -620,7 +621,17 @@ export class AdminService {
}
async updateSettings(data: Record<string, string>) {
const operations = Object.entries(data).map(([key, value]) => {
if (!data || typeof data !== 'object') return this.getSettings();
const mergedData: Record<string, string> = { ...data };
Object.entries(data).forEach(([key, value]) => {
const aliases = CANONICAL_ALIASES[key] || [];
aliases.forEach((alias) => {
mergedData[alias] = String(value);
});
});
const operations = Object.entries(mergedData).map(([key, value]) => {
return this.prisma.uiText.upsert({
where: { key },
update: { value: String(value) },
@@ -629,6 +640,20 @@ export class AdminService {
});
await this.prisma.$transaction(operations);
// Also sync setting table
for (const [key, value] of Object.entries(mergedData)) {
try {
await this.prisma.setting.upsert({
where: { key },
update: { value: String(value) },
create: { key, value: String(value), category: 'general' },
});
} catch (e) {
// ignore
}
}
return this.getSettings();
}