.
This commit is contained in:
parent
1d27ecb4a5
commit
0236c9b76e
@ -5,6 +5,7 @@ const { extractParamsFromRequest, handleErrorResponse, handleResultResponse } =
|
||||
function buildContext(req, config) {
|
||||
return {
|
||||
user: req.user,
|
||||
scopes: [],
|
||||
...config,
|
||||
}
|
||||
}
|
||||
@ -50,6 +51,7 @@ const generateControllers = (service, extraControllers = {}, options = {}) => {
|
||||
const result = await service.fetchOne(params, buildContext(req, config));
|
||||
return handleResultResponse(result, null, params, res, (result === null) ? httpStatus.NOT_FOUND : httpStatus.OK);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
handleErrorResponse(_options.MODULE_NAME, 'findOne', error, res)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user