Skip to content

Commit 6f0f282

Browse files
sujitawankita-p17
authored andcommitted
fix: improve validation in session listing and deletion APIs (#1462)
* fix/validation issues for session list and delete api Signed-off-by: sujitaw <[email protected]> * fix/fixed code rabbit comments Signed-off-by: sujitaw <[email protected]> --------- Signed-off-by: sujitaw <[email protected]> Signed-off-by: Ankita Patidar <[email protected]>
1 parent 1e65e77 commit 6f0f282

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

apps/api-gateway/src/authz/authz.controller.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import { UnauthorizedErrorDto } from '../dtos/unauthorized-error.dto';
5454
import { User } from './decorators/user.decorator';
5555
import { user } from '@prisma/client';
5656
import * as useragent from 'express-useragent';
57+
import { TrimStringParamPipe } from '@credebl/common/cast.helper';
5758

5859
@Controller('auth')
5960
@ApiTags('auth')
@@ -381,9 +382,10 @@ export class AuthzController {
381382
@Res() res: Response,
382383
@Param(
383384
'userId',
385+
new TrimStringParamPipe(),
384386
new ParseUUIDPipe({
385387
exceptionFactory: (): Error => {
386-
throw new BadRequestException(`Invalid format for User Id`);
388+
throw new BadRequestException(`Invalid user ID`);
387389
}
388390
})
389391
)
@@ -422,9 +424,10 @@ export class AuthzController {
422424
@Res() res: Response,
423425
@Param(
424426
'sessionId',
427+
new TrimStringParamPipe(),
425428
new ParseUUIDPipe({
426429
exceptionFactory: (): Error => {
427-
throw new BadRequestException(`Invalid format for session Id`);
430+
throw new BadRequestException(`Invalid session ID`);
428431
}
429432
})
430433
)

0 commit comments

Comments
 (0)