Add product retrieval by department categories and typecasting fixes
- Added methods in `department_categories_o`, `departments_o`, and `categories_o` to retrieve products associated with department categories. - Updated `productsRoute` and `superuserDepartmentRoute` to fetch department-specific products. - Fixed typecasting in product price assignments for improved data consistency.
This commit is contained in:
@@ -135,8 +135,16 @@ class superuserDepartmentRoute
|
||||
(new logs_o())->add('departments', 'global', 1, $user->id, 'SUPERUSER_FETCH_DEPARTMENT_PRICES', 'Successfully fetched department prices');
|
||||
// Return the department
|
||||
$response->success(
|
||||
array_map(
|
||||
function ($price_row) {
|
||||
$price_row['id'] = (int)$price_row['id'];
|
||||
$price_row['department_id'] = (int)$price_row['department_id'];
|
||||
$price_row['product_id'] = (int)$price_row['product_id'];
|
||||
$price_row['price'] = (int)$price_row['price'];
|
||||
return $price_row;
|
||||
},
|
||||
(new departments_o())->getDepartmentProductPrices((int)$this->fromRequest('department_id'))
|
||||
);
|
||||
));
|
||||
} else {
|
||||
// Log the incident
|
||||
(new logs_o())->add('departments', 'global', 1, 0, 'SUPERUSER_FETCH_DEPARTMENT_PRICES', 'No user found, or invalid session');
|
||||
|
||||
Reference in New Issue
Block a user