repair get error code by brandId

This commit is contained in:
2025-12-04 15:38:19 +07:00
parent 096fe9461d
commit a8eb785a5b
4 changed files with 61 additions and 29 deletions

View File

@@ -4,9 +4,10 @@ const { setResponse, setResponsePaging } = require('../helpers/utils');
class ErrorCodeController {
static async getByBrandId(req, res) {
const { brandId } = req.params;
const queryParams = req.query;
const results = await ErrorCodeService.getErrorCodesByBrandId(brandId);
const response = setResponse(results, 'Error codes found');
const results = await ErrorCodeService.getErrorCodesByBrandId(brandId, queryParams);
const response = await setResponsePaging(queryParams, results, 'Error codes found');
res.status(response.statusCode).json(response);
}