mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-12-16 10:19:53 +03:00
refactor(): complex refactoring
This commit is contained in:
18
lib/decorators/pipe-context.decorator.ts
Normal file
18
lib/decorators/pipe-context.decorator.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Type } from '@nestjs/common'
|
||||
import { ContextTransformer } from '../interfaces'
|
||||
import { addHandlerToStore } from './'
|
||||
|
||||
export const PipeContext = <T>(transform: Type<ContextTransformer<T>>) => (
|
||||
target: Object,
|
||||
propertyKey: string,
|
||||
parameterIndex: number,
|
||||
) => {
|
||||
addHandlerToStore(target, propertyKey, {
|
||||
transformations: [
|
||||
{
|
||||
index: parameterIndex,
|
||||
transform,
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user