/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
apps/api/src/app/subscriptions/usecases/create-subscriptions/create-subscriptions.command.ts
51 строка
1 KB
Adam Chmara
feat(api-service,js): context bound topic subscriptions fixes NV-6980 (#9840)
16 янв 2026, 17:25
Не верифицирован
16 янв 2026, 17:25
fcd5fef
Код
Авторство
О чём код?
import { IsValidContextPayload } from '@novu/application-generic'; import { ContextPayload } from '@novu/shared'; import { Type } from 'class-transformer'; import { ArrayMaxSize, ArrayMinSize, IsArray, IsDefined, IsOptional, IsString, ValidateNested } from 'class-validator'; import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command'; import { GroupPreferenceFilterDto } from '../../../shared/dtos/subscriptions/create-subscriptions.dto'; export class TopicSubscriberIdentifier { @IsString() @IsOptional() identifier?: string; @IsString() @IsDefined() subscriberId: string; @IsString() @IsOptional() name?: string; } export class CreateSubscriptionsCommand extends EnvironmentWithUserCommand { @IsString() @IsDefined() topicKey: string; @IsArray() @IsDefined() @ArrayMinSize(1, { message: 'At least one subscription is required' }) @ArrayMaxSize(100, { message: 'Cannot subscribe more than 100 subscriptions at once' }) @ValidateNested({ each: true }) @Type(() => TopicSubscriberIdentifier) subscriptions: TopicSubscriberIdentifier[]; @IsString() @IsOptional() name?: string; @IsArray() @IsOptional() preferences?: Array<GroupPreferenceFilterDto>; @IsValidContextPayload({ maxCount: 5 }) @IsOptional() context?: ContextPayload; @IsArray() @IsString({ each: true }) @IsOptional() contextKeys?: string[]; }