diff --git a/apps/api/src/app/events/usecases/parse-event-request/parse-event-request.command.ts b/apps/api/src/app/events/usecases/parse-event-request/parse-event-request.command.ts index a6156b15b2e..ab51b4bc6c1 100644 --- a/apps/api/src/app/events/usecases/parse-event-request/parse-event-request.command.ts +++ b/apps/api/src/app/events/usecases/parse-event-request/parse-event-request.command.ts @@ -1,4 +1,4 @@ -import { IsDefined, IsString, IsOptional, ValidateNested, ValidateIf, IsEnum } from 'class-validator'; +import { IsDefined, IsString, IsOptional, ValidateNested, ValidateIf, IsEnum, IsNumber } from 'class-validator'; import { AddressingTypeEnum, TriggerRecipients, @@ -6,6 +6,7 @@ import { TriggerRequestCategoryEnum, TriggerTenantContext, } from '@novu/shared'; +import { ApiHideProperty } from '@nestjs/swagger'; import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command'; @@ -37,6 +38,11 @@ export class ParseEventRequestBaseCommand extends EnvironmentWithUserCommand { @IsOptional() @IsEnum(TriggerRequestCategoryEnum) requestCategory?: TriggerRequestCategoryEnum; + + @ApiHideProperty() + @IsOptional() + @IsNumber() + priority?: number; } export class ParseEventRequestMulticastCommand extends ParseEventRequestBaseCommand { diff --git a/apps/api/src/app/events/usecases/parse-event-request/parse-event-request.usecase.ts b/apps/api/src/app/events/usecases/parse-event-request/parse-event-request.usecase.ts index f9baf6c6c97..7ff1710a972 100644 --- a/apps/api/src/app/events/usecases/parse-event-request/parse-event-request.usecase.ts +++ b/apps/api/src/app/events/usecases/parse-event-request/parse-event-request.usecase.ts @@ -137,7 +137,14 @@ export class ParseEventRequest { transactionId, }; - await this.workflowQueueService.add({ name: transactionId, data: jobData, groupId: command.organizationId }); + const options = process.env.IS_DOCKER_HOSTED === 'true' && command.priority ? { priority: command.priority } : {}; + + await this.workflowQueueService.add({ + name: transactionId, + data: jobData, + groupId: command.organizationId, + ...options, + }); return { acknowledged: true,