@@ -89,6 +89,24 @@ export const parseBoundRoutes = (boundRoutes: Array<Sails.Route>,
89
89
originalFn : { /*[Function] */ _middlewareType : 'BLUEPRINT: find' }
90
90
} ;
91
91
92
+ /* example of standard blueprint route but with standard action overridden in controller */
93
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
94
+ const standardBlueprintRouteWithOverriddenActionExampleForReference = {
95
+ path : '/user' ,
96
+ target : '[Function: routeTargetFnWrapper]' ,
97
+ verb : 'post' ,
98
+ options : {
99
+ model : 'user' ,
100
+ associations : [ /* [Object], [Object], [Object] */ ] ,
101
+ autoWatch : true ,
102
+ detectedVerb : { verb : '' , original : '/user' , path : '/user' } ,
103
+ action : 'user/create' ,
104
+ _middlewareType : 'ACTION: user/create' ,
105
+ skipRegex : [ ]
106
+ } ,
107
+ originalFn : /* [Function] */ { _middlewareType : 'ACTION: user/create' }
108
+ } ;
109
+
92
110
/* example of Sails.Route for custom route targetting blueprint action */
93
111
// eslint-disable-next-line @typescript-eslint/no-unused-vars
94
112
const customRouteTargettingBlueprintExampleForReference = {
@@ -260,6 +278,16 @@ export const parseBoundRoutes = (boundRoutes: Array<Sails.Route>,
260
278
const parsedPath = parsePath ( route . path ) ;
261
279
// let middlewareType, action, actionType;
262
280
281
+ if ( _middlewareType === 'action' && routeOptions . action ) {
282
+ const [ modelIdentity , actionToCheck ] = routeOptions . action . split ( '/' ) ;
283
+ if ( modelIdentity === routeOptions . model ) {
284
+ /* blueprint actions `{model}/{blueprintAction}` may be overriden by custom
285
+ * controller actions and thus annotated differently */
286
+ _middlewareType = 'blueprint' ;
287
+ mwtAction = actionToCheck ;
288
+ }
289
+ }
290
+
263
291
if ( _middlewareType === 'action' ) {
264
292
265
293
return {
0 commit comments