https://github.com/ApplaudSolutions/mbaas/issues/514 - stripping tenantId from custom model routes
This commit is contained in:
parent
c6072c70d8
commit
a74aa6754e
7
index.js
7
index.js
|
@ -140,9 +140,12 @@ function mountSwagger(loopbackApplication, swaggerApp, opts) {
|
|||
|
||||
if (swaggerObject && swaggerObject.paths) {
|
||||
var filteredSwaggerObject = JSON.parse(JSON.stringify(swaggerObject));
|
||||
filteredSwaggerObject.paths = _.pickBy(swaggerObject.paths, function(val, key) {
|
||||
filteredSwaggerObject.paths = _.reduce(_.pickBy(swaggerObject.paths, function(val, key) {
|
||||
return key.indexOf(swaggerFilterPath) === 0;
|
||||
});
|
||||
}), function(result, val, key) {
|
||||
result[key.replace(tenantId + '-', '')] = val;
|
||||
return result;
|
||||
}, {});
|
||||
res.status(200).send(filteredSwaggerObject);
|
||||
} else {
|
||||
res.status(200).send(swaggerObject);
|
||||
|
|
Loading…
Reference in New Issue