This commit is contained in:
@@ -40,7 +40,14 @@ export function createListingService({ listingRepository, inventoryImageReposito
|
||||
},
|
||||
|
||||
async list({ sellerId }) {
|
||||
return listingRepository.listBySellerId(sellerId);
|
||||
const listings = await listingRepository.listBySellerId(sellerId);
|
||||
if (!inventoryImageRepository) return listings;
|
||||
|
||||
return Promise.all(listings.map(async (listing) => ({
|
||||
...listing,
|
||||
imageCount: await inventoryImageRepository.countByInventoryItemId(listing.inventoryItemId),
|
||||
inventoryStatus: listing.inventoryStatus ?? 'ACTIVE',
|
||||
})));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user