@@ -44,7 +44,6 @@ import { CreateEcosystemDto, PaginationGetAllEcosystem } from 'apps/ecosystem/dt
4444import { DeleteEcosystemOrgDto } from './dtos/delete-ecosystem-users' ;
4545import { GetEcosystemInvitationsQueryDto , UpdateEcosystemOrgStatusDto } from './dtos/ecosystem' ;
4646import { IIntentTemplateList } from '@credebl/common/interfaces/intents-template.interface' ;
47- import { IUserRequest } from '@credebl/user-request/user-request.interface' ;
4847import { CreateIntentDto } from 'apps/ecosystem/dtos/create-intent.dto' ;
4948import { UpdateIntentDto } from 'apps/ecosystem/dtos/update-intent.dto' ;
5049import { GetAllIntentTemplatesResponseDto } from '../utilities/dtos/get-all-intent-templates-response.dto' ;
@@ -264,7 +263,7 @@ export class EcosystemController {
264263 TrimStringParamPipe ,
265264 new ParseUUIDPipe ( {
266265 exceptionFactory : ( ) : Error => {
267- throw new BadRequestException ( ResponseMessages . organisation . error . invalidOrgId ) ;
266+ throw new BadRequestException ( ResponseMessages . ecosystem . error . invalidOrgId ) ;
268267 }
269268 } )
270269 )
@@ -547,6 +546,7 @@ export class EcosystemController {
547546 async getIntentTemplatesByIntentId (
548547 @Param (
549548 'intentId' ,
549+ TrimStringParamPipe ,
550550 new ParseUUIDPipe ( {
551551 exceptionFactory : ( ) : Error => {
552552 throw new BadRequestException ( 'Invalid intent ID format' ) ;
@@ -580,7 +580,19 @@ export class EcosystemController {
580580 description : 'Retrieve all intent templates for a specific organization.'
581581 } )
582582 @ApiResponse ( { status : HttpStatus . OK , description : 'Intent templates retrieved successfully' , type : ApiResponseDto } )
583- async getIntentTemplatesByOrgId ( @Param ( 'orgId' ) orgId : string , @Res ( ) res : Response ) : Promise < Response > {
583+ async getIntentTemplatesByOrgId (
584+ @Param (
585+ 'orgId' ,
586+ TrimStringParamPipe ,
587+ new ParseUUIDPipe ( {
588+ exceptionFactory : ( ) : Error => {
589+ throw new BadRequestException ( 'Invalid orgId format' ) ;
590+ }
591+ } )
592+ )
593+ orgId : string ,
594+ @Res ( ) res : Response
595+ ) : Promise < Response > {
584596 const intentTemplates = await this . ecosystemService . getIntentTemplatesByOrgId ( orgId ) ;
585597 const finalResponse : IResponse = {
586598 statusCode : HttpStatus . OK ,
@@ -605,6 +617,7 @@ export class EcosystemController {
605617 async getIntentTemplateById (
606618 @Param (
607619 'id' ,
620+ TrimStringParamPipe ,
608621 new ParseUUIDPipe ( {
609622 exceptionFactory : ( ) : Error => {
610623 throw new BadRequestException ( ResponseMessages . oid4vpIntentToTemplate . error . invalidId ) ;
@@ -637,9 +650,18 @@ export class EcosystemController {
637650 @ApiOperation ( { summary : 'Update Intent Template' , description : 'Update an existing intent template mapping.' } )
638651 @ApiResponse ( { status : HttpStatus . OK , description : 'Intent template updated successfully' , type : ApiResponseDto } )
639652 async updateIntentTemplate (
640- @Param ( 'id' ) id : string ,
653+ @Param (
654+ 'id' ,
655+ TrimStringParamPipe ,
656+ new ParseUUIDPipe ( {
657+ exceptionFactory : ( ) : Error => {
658+ throw new BadRequestException ( ResponseMessages . oid4vpIntentToTemplate . error . invalidId ) ;
659+ }
660+ } )
661+ )
662+ id : string ,
641663 @Body ( ) updateIntentTemplateDto : UpdateIntentTemplateDto ,
642- @User ( ) user : IUserRequest ,
664+ @User ( ) user : user ,
643665 @Res ( ) res : Response
644666 ) : Promise < Response > {
645667 const intentTemplate = await this . ecosystemService . updateIntentTemplate ( id , updateIntentTemplateDto , user ) ;
@@ -741,6 +763,7 @@ export class EcosystemController {
741763 @Res ( ) res : Response ,
742764 @Param (
743765 'ecosystemId' ,
766+ TrimStringParamPipe ,
744767 new ParseUUIDPipe ( {
745768 exceptionFactory : ( ) : Error => {
746769 throw new BadRequestException ( ResponseMessages . ecosystem . error . invalidFormatOfEcosystemId ) ;
@@ -749,9 +772,18 @@ export class EcosystemController {
749772 )
750773 ecosystemId : string ,
751774 @Query ( ) pageDto : PaginationDto ,
752- @Query ( 'intentId' ) intentId ?: string
775+ @Query (
776+ 'intentId' ,
777+ new ParseUUIDPipe ( {
778+ optional : true ,
779+ exceptionFactory : ( ) : Error => {
780+ throw new BadRequestException ( ResponseMessages . ecosystem . error . invalidFormatOfIntentId ) ;
781+ }
782+ } )
783+ )
784+ intentId ?: string
753785 ) : Promise < Response > {
754- const intents = await this . ecosystemService . getIntents ( ecosystemId , pageDto , intentId ) ;
786+ const intents = await this . ecosystemService . getIntents ( ecosystemId , pageDto , intentId ?. trim ( ) ) ;
755787
756788 return res . status ( HttpStatus . OK ) . json ( {
757789 statusCode : HttpStatus . OK ,
@@ -781,7 +813,16 @@ export class EcosystemController {
781813 description : 'Template details fetched successfully'
782814 } )
783815 async getTemplateByIntentId (
784- @Param ( 'orgId' ) orgId : string ,
816+ @Param (
817+ 'orgId' ,
818+ TrimStringParamPipe ,
819+ new ParseUUIDPipe ( {
820+ exceptionFactory : ( ) : Error => {
821+ throw new BadRequestException ( ResponseMessages . ecosystem . error . invalidOrgId ) ;
822+ }
823+ } )
824+ )
825+ orgId : string ,
785826 @Res ( ) res : Response ,
786827 @Query ( ) pageDto : PaginationDto
787828 ) : Promise < Response > {
@@ -816,6 +857,7 @@ export class EcosystemController {
816857 async updateIntent (
817858 @Param (
818859 'ecosystemId' ,
860+ TrimStringParamPipe ,
819861 new ParseUUIDPipe ( {
820862 exceptionFactory : ( ) : Error => {
821863 throw new BadRequestException ( ResponseMessages . ecosystem . error . invalidFormatOfEcosystemId ) ;
@@ -825,6 +867,7 @@ export class EcosystemController {
825867 ecosystemId : string ,
826868 @Param (
827869 'intentId' ,
870+ TrimStringParamPipe ,
828871 new ParseUUIDPipe ( {
829872 exceptionFactory : ( ) : Error => {
830873 throw new BadRequestException ( ResponseMessages . ecosystem . error . invalidFormatOfIntentId ) ;
@@ -871,6 +914,7 @@ export class EcosystemController {
871914 async deleteIntent (
872915 @Param (
873916 'ecosystemId' ,
917+ TrimStringParamPipe ,
874918 new ParseUUIDPipe ( {
875919 exceptionFactory : ( ) : Error => {
876920 throw new BadRequestException ( ResponseMessages . ecosystem . error . invalidFormatOfEcosystemId ) ;
@@ -880,6 +924,7 @@ export class EcosystemController {
880924 ecosystemId : string ,
881925 @Param (
882926 'intentId' ,
927+ TrimStringParamPipe ,
883928 new ParseUUIDPipe ( {
884929 exceptionFactory : ( ) : Error => {
885930 throw new BadRequestException ( ResponseMessages . ecosystem . error . invalidFormatOfIntentId ) ;
0 commit comments