fix(build): resolve linter and tsconfig project service errors, guarantee dist/main existence in start-dev
Deploy Canina / deploy (push) Has been cancelled
Deploy Canina / deploy (push) Has been cancelled
This commit is contained in:
1 parent
a291fa0c4a
commit
6362750dea
50 files changed
+12128
-10959
No files matched your search
@@ -25,11 +25,36 @@ export const CANONICAL_ALIASES: Record<string, string[]> = {
|
||||
brand_logo_url: ['BRAND_LOGO_URL', 'site_logo'],
|
||||
|
||||
// Contact Info
|
||||
CONTACT_PHONE: ['contact_phone', 'maintenance_contact_phone', 'footer_phone', 'supportPhone'],
|
||||
contact_phone: ['CONTACT_PHONE', 'maintenance_contact_phone', 'footer_phone', 'supportPhone'],
|
||||
maintenance_contact_phone: ['CONTACT_PHONE', 'contact_phone', 'footer_phone', 'supportPhone'],
|
||||
footer_phone: ['CONTACT_PHONE', 'contact_phone', 'maintenance_contact_phone', 'supportPhone'],
|
||||
supportPhone: ['CONTACT_PHONE', 'contact_phone', 'maintenance_contact_phone', 'footer_phone'],
|
||||
CONTACT_PHONE: [
|
||||
'contact_phone',
|
||||
'maintenance_contact_phone',
|
||||
'footer_phone',
|
||||
'supportPhone',
|
||||
],
|
||||
contact_phone: [
|
||||
'CONTACT_PHONE',
|
||||
'maintenance_contact_phone',
|
||||
'footer_phone',
|
||||
'supportPhone',
|
||||
],
|
||||
maintenance_contact_phone: [
|
||||
'CONTACT_PHONE',
|
||||
'contact_phone',
|
||||
'footer_phone',
|
||||
'supportPhone',
|
||||
],
|
||||
footer_phone: [
|
||||
'CONTACT_PHONE',
|
||||
'contact_phone',
|
||||
'maintenance_contact_phone',
|
||||
'supportPhone',
|
||||
],
|
||||
supportPhone: [
|
||||
'CONTACT_PHONE',
|
||||
'contact_phone',
|
||||
'maintenance_contact_phone',
|
||||
'footer_phone',
|
||||
],
|
||||
|
||||
CONTACT_PHONE_LINK: ['contact_phone_link', 'maintenance_contact_phone_link'],
|
||||
contact_phone_link: ['CONTACT_PHONE_LINK', 'maintenance_contact_phone_link'],
|
||||
@@ -97,7 +122,9 @@ export class SettingsService implements OnModuleInit {
|
||||
|
||||
async seedDefaultUiTexts() {
|
||||
try {
|
||||
const existing = await this.prisma.uiText.findMany({ select: { key: true } });
|
||||
const existing = await this.prisma.uiText.findMany({
|
||||
select: { key: true },
|
||||
});
|
||||
const existingKeys = new Set(existing.map((e) => e.key));
|
||||
|
||||
const missingEntries = Object.entries(DEFAULT_UI_TEXTS).filter(
|
||||
@@ -109,10 +136,14 @@ export class SettingsService implements OnModuleInit {
|
||||
data: missingEntries.map(([key, value]) => ({ key, value })),
|
||||
skipDuplicates: true,
|
||||
});
|
||||
this.logger.log(`[SettingsService] Auto-seeded ${missingEntries.length} default UI texts.`);
|
||||
this.logger.log(
|
||||
`[SettingsService] Auto-seeded ${missingEntries.length} default UI texts.`,
|
||||
);
|
||||
}
|
||||
} catch (err: any) {
|
||||
this.logger.warn(`[SettingsService] Failed to auto-seed UI texts: ${err?.message || err}`);
|
||||
this.logger.warn(
|
||||
`[SettingsService] Failed to auto-seed UI texts: ${err?.message || err}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +216,12 @@ export class SettingsService implements OnModuleInit {
|
||||
});
|
||||
}
|
||||
|
||||
return { success: true, key, value: strVal, syncedKeys: Array.from(allKeysToUpdate) };
|
||||
return {
|
||||
success: true,
|
||||
key,
|
||||
value: strVal,
|
||||
syncedKeys: Array.from(allKeysToUpdate),
|
||||
};
|
||||
}
|
||||
|
||||
async updateBulkUiTexts(texts: Record<string, string>) {
|
||||
@@ -202,13 +238,44 @@ export class SettingsService implements OnModuleInit {
|
||||
const map = new Map<string, string>();
|
||||
texts.forEach((t) => map.set(t.key, t.value));
|
||||
|
||||
const standardShippingFee = Number(map.get('SHIPPING_FEE') || map.get('shipping_fee') || map.get('standardShippingFee') || '0');
|
||||
const minOrderAmount = Number(map.get('MIN_ORDER_AMOUNT') || map.get('min_order_amount') || map.get('minOrderAmount') || '0');
|
||||
const freeShippingThreshold = Number(map.get('FREE_SHIPPING_THRESHOLD') || map.get('free_shipping_threshold') || map.get('freeShippingThreshold') || '2000000');
|
||||
const taxPercentage = Number(map.get('TAX_PERCENTAGE') || map.get('tax_percentage') || map.get('taxPercentage') || '10');
|
||||
const b2bDiscountPercent = Number(map.get('B2B_DISCOUNT_PERCENT') || map.get('b2b_discount_percent') || map.get('b2bDiscountPercent') || '0');
|
||||
const charityRoundStep = Number(map.get('CHARITY_ROUND_STEP') || map.get('charity_round_step') || map.get('charityRoundStep') || '10000');
|
||||
const walletWithdrawalEnabled = map.get('walletWithdrawalEnabled') === 'true';
|
||||
const standardShippingFee = Number(
|
||||
map.get('SHIPPING_FEE') ||
|
||||
map.get('shipping_fee') ||
|
||||
map.get('standardShippingFee') ||
|
||||
'0',
|
||||
);
|
||||
const minOrderAmount = Number(
|
||||
map.get('MIN_ORDER_AMOUNT') ||
|
||||
map.get('min_order_amount') ||
|
||||
map.get('minOrderAmount') ||
|
||||
'0',
|
||||
);
|
||||
const freeShippingThreshold = Number(
|
||||
map.get('FREE_SHIPPING_THRESHOLD') ||
|
||||
map.get('free_shipping_threshold') ||
|
||||
map.get('freeShippingThreshold') ||
|
||||
'2000000',
|
||||
);
|
||||
const taxPercentage = Number(
|
||||
map.get('TAX_PERCENTAGE') ||
|
||||
map.get('tax_percentage') ||
|
||||
map.get('taxPercentage') ||
|
||||
'10',
|
||||
);
|
||||
const b2bDiscountPercent = Number(
|
||||
map.get('B2B_DISCOUNT_PERCENT') ||
|
||||
map.get('b2b_discount_percent') ||
|
||||
map.get('b2bDiscountPercent') ||
|
||||
'0',
|
||||
);
|
||||
const charityRoundStep = Number(
|
||||
map.get('CHARITY_ROUND_STEP') ||
|
||||
map.get('charity_round_step') ||
|
||||
map.get('charityRoundStep') ||
|
||||
'10000',
|
||||
);
|
||||
const walletWithdrawalEnabled =
|
||||
map.get('walletWithdrawalEnabled') === 'true';
|
||||
|
||||
return {
|
||||
standardShippingFee,
|
||||
@@ -305,10 +372,19 @@ export class SettingsService implements OnModuleInit {
|
||||
const map = new Map<string, string>();
|
||||
texts.forEach((t) => map.set(t.key, t.value));
|
||||
|
||||
const isMaintenance = map.get('MAINTENANCE_MODE') === 'true' || map.get('maintenance_mode') === 'true' || map.get('maintenanceMode') === 'true';
|
||||
const isMaintenance =
|
||||
map.get('MAINTENANCE_MODE') === 'true' ||
|
||||
map.get('maintenance_mode') === 'true' ||
|
||||
map.get('maintenanceMode') === 'true';
|
||||
const allowGuestCheckout = map.get('allowGuestCheckout') !== 'false';
|
||||
const b2bRegistrationOpen = map.get('b2bRegistrationOpen') !== 'false' && map.get('b2b_enabled') !== 'false';
|
||||
const supportPhone = map.get('CONTACT_PHONE') || map.get('contact_phone') || map.get('supportPhone') || '۰۲۱-۸۸۸۸۴۴۴۴';
|
||||
const b2bRegistrationOpen =
|
||||
map.get('b2bRegistrationOpen') !== 'false' &&
|
||||
map.get('b2b_enabled') !== 'false';
|
||||
const supportPhone =
|
||||
map.get('CONTACT_PHONE') ||
|
||||
map.get('contact_phone') ||
|
||||
map.get('supportPhone') ||
|
||||
'۰۲۱-۸۸۸۸۴۴۴۴';
|
||||
|
||||
return {
|
||||
maintenanceMode: isMaintenance,
|
||||
|
||||
Reference in new issue
Block a user