mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
fix: add count property to item categories list response.
This commit is contained in:
@@ -269,6 +269,9 @@ export default class ItemCategoriesService implements IItemCategoriesService {
|
||||
const dynamicList = await this.dynamicListService.dynamicList(tenantId, ItemCategory, filter);
|
||||
|
||||
const itemCategories = await ItemCategory.query().onBuild((query) => {
|
||||
// Subquery to calculate sumation of assocaited items to the item category.
|
||||
query.select('*', ItemCategory.relatedQuery('items').count().as('count'));
|
||||
|
||||
dynamicList.buildQuery()(query);
|
||||
});
|
||||
return { itemCategories, filterMeta: dynamicList.getResponseMeta() };
|
||||
|
||||
Reference in New Issue
Block a user