fix(server): prevent delete base currency

This commit is contained in:
a.bouhuolia
2023-04-14 03:45:09 +02:00
parent cc863f774a
commit 6bd30abddb
2 changed files with 41 additions and 32 deletions

View File

@@ -0,0 +1,19 @@
import { Transformer } from '@/lib/Transformer/Transformer';
export class CurrencyTransformer extends Transformer {
/**
* Include these attributes to sale invoice object.
* @returns {Array}
*/
public includeAttributes = (): string[] => {
return ['isBaseCurrency'];
};
/**
* Detarmines whether the currency is base currency.
* @returns {boolean}
*/
public isBaseCurrency(currency): boolean {
return this.context.organization.baseCurrency === currency.currencyCode;
}
}