Skip to content

Commit

Permalink
chore : changed query param userId
Browse files Browse the repository at this point in the history
  • Loading branch information
Xitija committed Nov 11, 2024
1 parent 345eb51 commit 60b626f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/common/utils/constants.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
14 changes: 7 additions & 7 deletions src/modules/event/event.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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);
Expand All @@ -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,
})
Expand All @@ -100,18 +100,18 @@ 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);
}

@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,
Expand All @@ -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);
}
Expand Down

0 comments on commit 60b626f

Please sign in to comment.