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