Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private overrideRoutes(routesSchema: BaseRoute[]) {
getOwnPropNames(this.targetProto).forEach((name) => {
const override = R.getOverrideRoute(this.targetProto[name]);
const route = routesSchema.find((r) => isEqual(r.name, override));
if (override && route && route.enable) {
// get metadata
const interceptors = R.getInterceptors(this.targetProto[name]);
const baseInterceptors = R.getInterceptors(this.targetProto[override]);
const baseAction = R.getAction(this.targetProto[override]);
const operation = Swagger.getOperation(this.targetProto[name]);
const baseOperation = Swagger.getOperation(this.targetProto[override]);
const swaggerParams = Swagger.getParams(this.targetProto[name]);
const baseSwaggerParams = Swagger.getParams(this.targetProto[override]);
const responseOk = Swagger.getResponseOk(this.targetProto[name]);
const baseResponseOk = Swagger.getResponseOk(this.targetProto[override]);
// set metadata
R.setInterceptors([...baseInterceptors, ...interceptors], this.targetProto[name]);
overrideRoutes(routesSchema) {
util_1.getOwnPropNames(this.targetProto).forEach((name) => {
const override = reflection_helper_1.R.getOverrideRoute(this.targetProto[name]);
const route = routesSchema.find((r) => util_1.isEqual(r.name, override));
if (override && route && route.enable) {
const interceptors = reflection_helper_1.R.getInterceptors(this.targetProto[name]);
const baseInterceptors = reflection_helper_1.R.getInterceptors(this.targetProto[override]);
const baseAction = reflection_helper_1.R.getAction(this.targetProto[override]);
const baseSwaggerParams = swagger_helper_1.Swagger.getParams(this.targetProto[override]);
const baseResponseOk = swagger_helper_1.Swagger.getResponseOk(this.targetProto[override]);
reflection_helper_1.R.setInterceptors([...baseInterceptors, ...interceptors], this.targetProto[name]);
reflection_helper_1.R.setAction(baseAction, this.targetProto[name]);
swagger_helper_1.Swagger.setOperation(override, this.modelName, this.targetProto[name]);
swagger_helper_1.Swagger.setParams(baseSwaggerParams, this.targetProto[name]);
swagger_helper_1.Swagger.setResponseOk(baseResponseOk, this.targetProto[name]);
this.overrideParsedBodyDecorator(override, name);
reflection_helper_1.R.setRoute(route, this.targetProto[name]);
route.override = true;