From 60b626fab18190d6d58e21a153755e33561b5090 Mon Sep 17 00:00:00 2001 From: Kshitija Kadam <65657373+Xitija@users.noreply.github.com> Date: Mon, 11 Nov 2024 17:47:23 +0530 Subject: [PATCH] chore : changed query param userId --- src/common/utils/constants.util.ts | 2 +- src/modules/event/event.controller.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/common/utils/constants.util.ts b/src/common/utils/constants.util.ts index 68d7b54..3fbfb1b 100644 --- a/src/common/utils/constants.util.ts +++ b/src/common/utils/constants.util.ts @@ -88,7 +88,7 @@ export const ERROR_MESSAGES = { 'End condition by occurrences is not implemented yet', EVENT_TYPE_CHANGE_NOT_SUPPORTED: 'Event type change not supported', USERID_INVALID: 'Invalid UserId', - PROVIDE_ONE_USERID_IN_QUERY: 'Please provide only one userid in query', + PROVIDE_ONE_USERID_IN_QUERY: 'Please provide userId in query params', API_REQ_FAILURE: (url: string) => `Error occurred on API Request: ${url}`, DB_QUERY_FAILURE: (url: string) => `Database Query Failed on API: ${url}`, API_FAILURE: (url: string) => `API Failure: ${url}`, diff --git a/src/modules/event/event.controller.ts b/src/modules/event/event.controller.ts index 44af030..ce05121 100644 --- a/src/modules/event/event.controller.ts +++ b/src/modules/event/event.controller.ts @@ -53,7 +53,7 @@ export class EventController { @UseFilters(new AllExceptionsFilter(API_ID.CREATE_EVENT)) @Post('/create') @ApiBody({ type: CreateEventDto }) - @ApiQuery({ name: 'userid', required: true }) + @ApiQuery({ name: 'userId', required: true }) @UsePipes( new ValidationPipe({ transform: true }), new DateValidationPipe(), @@ -73,7 +73,7 @@ export class EventController { @Res() response: Response, @Req() request: Request, ) { - const userId: string = checkValidUserId(request.query.userid); + const userId: string = checkValidUserId(request.query?.userId); createEventDto.createdBy = userId; createEventDto.updatedBy = userId; return this.eventService.createEvent(createEventDto, response); @@ -82,7 +82,7 @@ export class EventController { @UseFilters(new AllExceptionsFilter(API_ID.GET_EVENTS)) @Post('/list') @ApiBody({ type: SearchFilterDto }) - @ApiQuery({ name: 'userid', required: true }) + @ApiQuery({ name: 'userId', required: true }) @ApiInternalServerErrorResponse({ description: ERROR_MESSAGES.INTERNAL_SERVER_ERROR, }) @@ -100,10 +100,10 @@ export class EventController { @Req() request: Request, ) { let userId: string; - if (!request.query?.userid) { + if (!request.query?.userId) { userId = null; } else { - userId = checkValidUserId(request.query?.userid); + userId = checkValidUserId(request.query?.userId); } return this.eventService.getEvents(response, requestBody, userId); } @@ -111,7 +111,7 @@ export class EventController { @UseFilters(new AllExceptionsFilter(API_ID.UPDATE_EVENT)) @Patch('/:id') @ApiBody({ type: UpdateEventDto }) - @ApiQuery({ name: 'userid', required: true }) + @ApiQuery({ name: 'userId', required: true }) @ApiResponse({ status: 200, description: SUCCESS_MESSAGES.EVENT_UPDATED }) @ApiInternalServerErrorResponse({ description: ERROR_MESSAGES.INTERNAL_SERVER_ERROR, @@ -126,7 +126,7 @@ export class EventController { if (!updateEventDto || Object.keys(updateEventDto).length === 0) { throw new BadRequestException(ERROR_MESSAGES.INVALID_REQUEST_BODY); } - const userId: string = checkValidUserId(request.query.userid); + const userId: string = checkValidUserId(request.query?.userId); updateEventDto.updatedBy = userId; return this.eventService.updateEvent(id, updateEventDto, response); }