-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from abbl/controller-pattern
Append controller message patterns with controller scoped pattern
- Loading branch information
Showing
7 changed files
with
48 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const PATTERN_METADATA = 'PATTERN_METADATA'; | ||
export const CONTROLLER_PATTERN_METADATA = 'CONTROLLER_PATTERN_METADATA'; | ||
export const HANDLER_PATTERN_METADATA = 'HANDLER_PATTERN_METADATA'; | ||
export const HANDLER_ARGS_METADATA = 'HANDLER_ARGS_METADATA'; | ||
export const MIDDLEWARE_METADATA = 'MIDDLEWARE_METADATA'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { CONTROLLER_PATTERN_METADATA } from '../constants/decorators'; | ||
|
||
export default function Controller(pattern: string): ClassDecorator { | ||
return (target) => { | ||
Reflect.defineMetadata(CONTROLLER_PATTERN_METADATA, pattern, target.prototype); | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
/* eslint-disable @typescript-eslint/ban-types */ | ||
import 'reflect-metadata'; | ||
import { PATTERN_METADATA } from '../constants/decorators'; | ||
import { HANDLER_PATTERN_METADATA } from '../constants/decorators'; | ||
|
||
export default function MessagePattern(pattern: string): MethodDecorator { | ||
return (target, propertyKey, descriptor) => { | ||
Reflect.defineMetadata(PATTERN_METADATA, pattern, descriptor.value); | ||
Reflect.defineMetadata(HANDLER_PATTERN_METADATA, pattern, descriptor.value); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters