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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user