@@ -23,6 +23,7 @@ import { ClientProxy} from '@nestjs/microservices';
23
23
import { BasicMessageDto , QuestionAnswerWebhookDto , QuestionDto } from './dtos/question-answer.dto' ;
24
24
// eslint-disable-next-line @typescript-eslint/no-unused-vars
25
25
import { user } from '@prisma/client' ;
26
+ import { TrimStringParamPipe } from '@credebl/common/cast.helper' ;
26
27
@UseFilters ( CustomExceptionFilter )
27
28
@Controller ( )
28
29
@ApiTags ( 'connections' )
@@ -52,8 +53,8 @@ export class ConnectionController {
52
53
@ApiResponse ( { status : HttpStatus . OK , description : 'Success' , type : ApiResponseDto } )
53
54
async getConnectionsById (
54
55
@User ( ) user : IUserRequest ,
55
- @Param ( 'connectionId' ) connectionId : string ,
56
56
@Param ( 'orgId' ) orgId : string ,
57
+ @Param ( 'connectionId' , TrimStringParamPipe , new ParseUUIDPipe ( { exceptionFactory : ( ) : Error => { throw new BadRequestException ( ResponseMessages . connection . error . invalidConnectionId ) ; } } ) ) connectionId : string ,
57
58
@Res ( ) res : Response
58
59
) : Promise < Response > {
59
60
const connectionsDetails = await this . connectionService . getConnectionsById ( user , connectionId , orgId ) ;
@@ -416,13 +417,13 @@ export class ConnectionController {
416
417
* @returns The details of the sent basic message
417
418
*/
418
419
@Post ( '/orgs/:orgId/basic-message/:connectionId' )
419
- @ApiOperation ( { summary : 'Send basic message' , description : 'Send a basic message to a specific connection for a specific organization.' } )
420
- @UseGuards ( AuthGuard ( 'jwt' ) , OrgRolesGuard )
420
+ @ApiOperation ( { summary : 'Send basic message' , description : 'Send a basic message to a specific connection for a specific organization.' } )
421
+ @UseGuards ( AuthGuard ( 'jwt' ) , OrgRolesGuard )
421
422
@Roles ( OrgRoles . OWNER , OrgRoles . ADMIN , OrgRoles . ISSUER , OrgRoles . VERIFIER , OrgRoles . MEMBER , OrgRoles . HOLDER , OrgRoles . SUPER_ADMIN , OrgRoles . PLATFORM_ADMIN )
422
423
@ApiResponse ( { status : HttpStatus . CREATED , description : 'Created' , type : ApiResponseDto } )
423
424
async sendBasicMessage (
424
425
@Param ( 'orgId' ) orgId : string ,
425
- @Param ( 'connectionId' ) connectionId : string ,
426
+ @Param ( 'connectionId' , TrimStringParamPipe , new ParseUUIDPipe ( { exceptionFactory : ( ) : Error => { throw new BadRequestException ( ResponseMessages . connection . error . invalidConnectionId ) ; } } ) ) connectionId : string ,
426
427
@Body ( ) basicMessageDto : BasicMessageDto ,
427
428
@User ( ) reqUser : IUserRequestInterface ,
428
429
@Res ( ) res : Response
0 commit comments