mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
fix: add graphed models to item specific.
This commit is contained in:
@@ -513,12 +513,10 @@ export default class ItemsService implements IItemsService {
|
|||||||
|
|
||||||
const item = await Item.query()
|
const item = await Item.query()
|
||||||
.findById(itemId)
|
.findById(itemId)
|
||||||
.withGraphFetched(
|
.withGraphFetched('sellAccount')
|
||||||
'costAccount',
|
.withGraphFetched('inventoryAccount')
|
||||||
'sellAccount',
|
.withGraphFetched('category')
|
||||||
'inventoryAccount',
|
.withGraphFetched('costAccount');
|
||||||
'category'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
throw new ServiceError(ERRORS.NOT_FOUND);
|
throw new ServiceError(ERRORS.NOT_FOUND);
|
||||||
@@ -664,7 +662,7 @@ export default class ItemsService implements IItemsService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...item,
|
...item.toObject ? item.toObject() : item,
|
||||||
sellPriceFormatted: formatNumber(item.sellPrice, { currencyCode }),
|
sellPriceFormatted: formatNumber(item.sellPrice, { currencyCode }),
|
||||||
costPriceFormatted: formatNumber(item.costPrice, { currencyCode }),
|
costPriceFormatted: formatNumber(item.costPrice, { currencyCode }),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user