refactor: accounts module to Nestjs

This commit is contained in:
Ahmed Bouhuolia
2024-12-16 16:45:56 +02:00
parent 87e9cd64e8
commit bfff56c470
37 changed files with 3482 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
import { Transformer } from '../Transformer/Transformer';
import { Item } from './models/Item';
// import { GetItemWarehouseTransformer } from '@/services/Warehouses/Items/GettItemWarehouseTransformer';
export class ItemTransformer extends Transformer {
@@ -20,7 +21,7 @@ export class ItemTransformer extends Transformer {
* @param {IItem} item
* @returns {string}
*/
public typeFormatted(item): string {
public typeFormatted(item: Item): string {
return this.context.i18n.t(`item.field.type.${item.type}`);
}
@@ -29,7 +30,7 @@ export class ItemTransformer extends Transformer {
* @param item
* @returns {string}
*/
public sellPriceFormatted(item): string {
public sellPriceFormatted(item: Item): string {
return this.formatNumber(item.sellPrice, {
currencyCode: this.context.organization.baseCurrency,
});
@@ -40,7 +41,7 @@ export class ItemTransformer extends Transformer {
* @param item
* @returns {string}
*/
public costPriceFormatted(item): string {
public costPriceFormatted(item: Item): string {
return this.formatNumber(item.costPrice, {
currencyCode: this.context.organization.baseCurrency,
});

View File

@@ -8,13 +8,13 @@ import { ServiceError } from './ServiceError';
import { IItem, IItemDTO } from '@/interfaces/Item';
import { ERRORS } from './Items.constants';
import { Item } from './models/Item';
import { Account } from '../Accounts/models/Account';
import { AccountModel } from '../Accounts/models/Account.model';
@Injectable()
export class ItemsValidators {
constructor(
@Inject(Item.name) private itemModel: typeof Item,
@Inject(Account.name) private accountModel: typeof Account,
@Inject(AccountModel.name) private accountModel: typeof AccountModel,
@Inject(Item.name) private taxRateModel: typeof Item,
@Inject(Item.name) private itemEntryModel: typeof Item,
@Inject(Item.name) private itemCategoryModel: typeof Item,