From 757b5e88e41509049cd5096323f7f6ac498267e4 Mon Sep 17 00:00:00 2001 From: Constantin Bergatt Date: Tue, 15 Oct 2024 07:10:20 +0200 Subject: [PATCH] BC-7879 - fix `AuthorizationContextParams` to handle enum types correctly --- .../authorization/api/dto/authorization-body.params.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/server/src/modules/authorization/api/dto/authorization-body.params.ts b/apps/server/src/modules/authorization/api/dto/authorization-body.params.ts index c2e7b4656ff..474a3eeb865 100644 --- a/apps/server/src/modules/authorization/api/dto/authorization-body.params.ts +++ b/apps/server/src/modules/authorization/api/dto/authorization-body.params.ts @@ -1,5 +1,5 @@ -import { Permission } from '@shared/domain/interface'; import { ApiProperty } from '@nestjs/swagger'; +import { Permission } from '@shared/domain/interface'; import { Type } from 'class-transformer'; import { IsArray, IsEnum, IsMongoId, ValidateNested } from 'class-validator'; import { Action, AuthorizableReferenceType, AuthorizationContext } from '../../domain'; @@ -7,9 +7,9 @@ import { Action, AuthorizableReferenceType, AuthorizationContext } from '../../d class AuthorizationContextParams implements AuthorizationContext { @IsEnum(Action) @ApiProperty({ - description: 'Define for which action the operation should be performend.', + name: 'action', enum: Action, - enumName: 'Action', + description: 'Define for which action the operation should be performend.', example: Action.read, }) action!: Action; @@ -17,11 +17,11 @@ class AuthorizationContextParams implements AuthorizationContext { @IsArray() @IsEnum(Permission, { each: true }) @ApiProperty({ + name: 'requiredPermissions', enum: Permission, - enumName: 'Permission', isArray: true, description: 'User permissions that are needed to execute the operation.', - example: Permission.USER_UPDATE, + example: [Permission.USER_UPDATE], }) requiredPermissions!: Permission[]; }