@@ -8,6 +8,7 @@ import {ResponseHandlerMetadata} from "../metadata/ResponseHandleMetadata";
8
8
import { RoutingControllersOptions } from "../RoutingControllersOptions" ;
9
9
import { UseMetadata } from "../metadata/UseMetadata" ;
10
10
import { getMetadataArgsStorage } from "../index" ;
11
+ import { ActionMetadataArgs } from "../metadata/args/ActionMetadataArgs" ;
11
12
12
13
/**
13
14
* Builds metadata from the given metadata arguments.
@@ -84,8 +85,21 @@ export class MetadataBuilder {
84
85
* Creates action metadatas.
85
86
*/
86
87
protected createActions ( controller : ControllerMetadata ) : ActionMetadata [ ] {
87
- return getMetadataArgsStorage ( )
88
- . filterActionsWithTarget ( controller . target )
88
+ let target = controller . target ;
89
+ let actionsWithTarget : ActionMetadataArgs [ ] = [ ] ;
90
+ while ( target ) {
91
+ actionsWithTarget . push (
92
+ ...getMetadataArgsStorage ( )
93
+ . filterActionsWithTarget ( target )
94
+ . filter ( action => {
95
+ return actionsWithTarget
96
+ . map ( a => a . method )
97
+ . indexOf ( action . method ) === - 1 ;
98
+ } )
99
+ ) ;
100
+ target = Object . getPrototypeOf ( target ) ;
101
+ }
102
+ return actionsWithTarget
89
103
. map ( actionArgs => {
90
104
const action = new ActionMetadata ( controller , actionArgs , this . options ) ;
91
105
action . options = { ...controller . options , ...actionArgs . options } ;
0 commit comments