.
This commit is contained in:
parent
b97272c869
commit
48d258e407
@ -69,6 +69,20 @@ const generateControllers = (service, extraControllers = {}, options = {}) => {
|
|||||||
const params = extractParamsFromRequest(req, res, _options.params.findOne);
|
const params = extractParamsFromRequest(req, res, _options.params.findOne);
|
||||||
try {
|
try {
|
||||||
let result = await service.fetchOne(params, buildContext(req, config));
|
let result = await service.fetchOne(params, buildContext(req, config));
|
||||||
|
|
||||||
|
//MAPEO SALIDA API4
|
||||||
|
//Tratamos resultado, si hay que remover campos para API4 web
|
||||||
|
if (res.locals.v4){
|
||||||
|
const arrayFieldsremove = res.locals.v4.removeFields;
|
||||||
|
result.rows.map((row)=>{
|
||||||
|
arrayFieldsremove.forEach(campo => {
|
||||||
|
if (campo in row) {
|
||||||
|
delete row[campo];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
result = _options.findOneCallback !== undefined ? _options.findOneCallback(result) : result;
|
result = _options.findOneCallback !== undefined ? _options.findOneCallback(result) : result;
|
||||||
return handleResultResponse(
|
return handleResultResponse(
|
||||||
result,
|
result,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user