diff --git a/src/common/filters/exception.filter.ts b/src/common/filters/exception.filter.ts index 7a034c6..2003a17 100644 --- a/src/common/filters/exception.filter.ts +++ b/src/common/filters/exception.filter.ts @@ -26,7 +26,16 @@ export class AllExceptionsFilter implements ExceptionFilter { let errorMessage = exception?.message || ERROR_MESSAGES.INTERNAL_SERVER_ERROR; - if (exception instanceof QueryFailedError) { + if (exception instanceof HttpException) { + const statusCode = exception.getStatus(); + const errorResponse = APIResponse.error( + this.apiId, + (exception.getResponse() as any)?.message, + ERROR_MESSAGES.BAD_REQUEST, + statusCode.toString(), + ); + return response.status(statusCode).json(errorResponse); + } else if (exception instanceof QueryFailedError) { const statusCode = HttpStatus.UNPROCESSABLE_ENTITY; const errorResponse = APIResponse.error( this.apiId, diff --git a/src/common/utils/transformer/date.transformer.ts b/src/common/utils/transformer/date.transformer.ts index 5e0fd6f..7f6e801 100644 --- a/src/common/utils/transformer/date.transformer.ts +++ b/src/common/utils/transformer/date.transformer.ts @@ -6,7 +6,7 @@ import { ValueTransformer } from 'typeorm'; export class TimeZoneTransformer implements ValueTransformer { // private timeZone: string; - constructor(private configService: ConfigService) {} + constructor(private readonly configService: ConfigService) {} // To DB: Convert the date to UTC before saving to(entityValue: Date): Date { diff --git a/src/common/utils/validation.util.ts b/src/common/utils/validation.util.ts index affbb03..6e5d3af 100644 --- a/src/common/utils/validation.util.ts +++ b/src/common/utils/validation.util.ts @@ -6,8 +6,9 @@ import { function validateMeetingUrl(url, provider) { const providerPatterns = { - zoom: /^https:\/\/[\w-]*\.?zoom.us\/(j|my)\/[-\w?=]+$/, - googlemeet: /^(https:\/\/)?meet\.google\.com\/[a-zA-Z0-9-]+$/, + zoom: /^https?:\/\/[\w-]*\.?zoom\.(com|us)\/(j|my)\/[\w-]+(\?[\w=&-]*)?$/, + googlemeet: + /^https?:\/\/meet\.(google\.com|[a-zA-Z0-9-]+\.com)\/[a-z]{3,}-[a-z]{3,}-[a-z]{3}(\?[\w=&-]*)?$/, // microsoftteams: /^(https:\/\/)?teams\.microsoft\.com\/[a-zA-Z0-9?&=]+$/, // Add other supported providers as needed }; diff --git a/src/modules/event/dto/update-event.dto.ts b/src/modules/event/dto/update-event.dto.ts index 597af5c..6a6cb6f 100644 --- a/src/modules/event/dto/update-event.dto.ts +++ b/src/modules/event/dto/update-event.dto.ts @@ -68,7 +68,7 @@ export class UpdateEventDto { example: { url: 'https://example.com/meeting', id: '123-456-789', - password: 'xxxxxxx', + // password: 'xxxxxxx', // This will be hidden from API response docs }, }) @IsObject() diff --git a/src/modules/event/event.service.ts b/src/modules/event/event.service.ts index c62f547..4e48b29 100644 --- a/src/modules/event/event.service.ts +++ b/src/modules/event/event.service.ts @@ -43,8 +43,8 @@ import { compareArrays } from 'src/common/utils/functions.util'; import * as moment from 'moment-timezone'; @Injectable() export class EventService { - private eventCreationLimit: number; - private timezone: string; + private readonly eventCreationLimit: number; + private readonly timezone: string; constructor( @InjectRepository(Events)