mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-09-23 09:49:06 +03:00
feat(param-decorators): add new paramtypes & make possible to get property from object
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
export * from './context.decorator';
|
||||
export * from './next.decorator';
|
||||
export * from './message-text.decorator';
|
||||
export * from './message.decorator';
|
||||
export * from './sender.decorator';
|
||||
|
@@ -1,10 +0,0 @@
|
||||
import { PipeTransform, Type } from '@nestjs/common';
|
||||
import { createTelegrafPipesParamDecorator } from '../../utils/param-decorator.util';
|
||||
import { TelegrafParamtype } from '../../enums/telegraf-paramtype.enum';
|
||||
|
||||
export function MessageText(...pipes: (Type<PipeTransform> | PipeTransform)[]) {
|
||||
return createTelegrafPipesParamDecorator(TelegrafParamtype.MESSAGE_TEXT)(
|
||||
undefined,
|
||||
...pipes,
|
||||
);
|
||||
}
|
21
lib/decorators/params/message.decorator.ts
Normal file
21
lib/decorators/params/message.decorator.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { PipeTransform, Type } from '@nestjs/common';
|
||||
import { createTelegrafPipesParamDecorator } from '../../utils/param-decorator.util';
|
||||
import { TelegrafParamtype } from '../../enums/telegraf-paramtype.enum';
|
||||
|
||||
export function Message(): ParameterDecorator;
|
||||
export function Message(
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
export function Message(
|
||||
property: string,
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
export function Message(
|
||||
property?: string | (Type<PipeTransform> | PipeTransform),
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
) {
|
||||
return createTelegrafPipesParamDecorator(TelegrafParamtype.MESSAGE)(
|
||||
property,
|
||||
...pipes,
|
||||
);
|
||||
}
|
21
lib/decorators/params/sender.decorator.ts
Normal file
21
lib/decorators/params/sender.decorator.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { PipeTransform, Type } from '@nestjs/common';
|
||||
import { createTelegrafPipesParamDecorator } from '../../utils/param-decorator.util';
|
||||
import { TelegrafParamtype } from '../../enums/telegraf-paramtype.enum';
|
||||
|
||||
export function Sender(): ParameterDecorator;
|
||||
export function Sender(
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
export function Sender(
|
||||
property: string,
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
export function Sender(
|
||||
property?: string | (Type<PipeTransform> | PipeTransform),
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
) {
|
||||
return createTelegrafPipesParamDecorator(TelegrafParamtype.SENDER)(
|
||||
property,
|
||||
...pipes,
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user