Enhance product price retrieval by including currentRegionId in FalukantController and FalukantService

- Updated the FalukantController to accept currentRegionId as a parameter for fetching product prices in cities.
- Modified the FalukantService to incorporate currentRegionId in the price calculation logic, allowing exclusion of the current region from results.
- Adjusted frontend components to pass currentRegionId, improving the accuracy of price comparisons and user experience.
This commit is contained in:
Torsten Schulz (local)
2025-12-03 08:39:30 +01:00
parent 6ec62af606
commit 4eeb5021ee
4 changed files with 14 additions and 11 deletions

View File

@@ -155,10 +155,11 @@ class FalukantController {
this.getProductPricesInCities = this._wrapWithUser((userId, req) => {
const productId = parseInt(req.query.productId, 10);
const currentPrice = parseFloat(req.query.currentPrice);
const currentRegionId = req.query.currentRegionId ? parseInt(req.query.currentRegionId, 10) : null;
if (Number.isNaN(productId) || Number.isNaN(currentPrice)) {
throw new Error('productId and currentPrice are required');
}
return this.service.getProductPricesInCities(userId, productId, currentPrice);
return this.service.getProductPricesInCities(userId, productId, currentPrice, currentRegionId);
});
this.renovate = this._wrapWithUser((userId, req) => this.service.renovate(userId, req.body.element));
this.renovateAll = this._wrapWithUser((userId) => this.service.renovateAll(userId));