From 537da01b6e1caf79110a3919278a4a1ac1782f81 Mon Sep 17 00:00:00 2001 From: ssoxong Date: Wed, 1 May 2024 23:05:53 +0900 Subject: [PATCH] fix: 5b12d34 --- src/event/event.repository.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/event/event.repository.ts b/src/event/event.repository.ts index 5fd17be..9d7bcb9 100644 --- a/src/event/event.repository.ts +++ b/src/event/event.repository.ts @@ -1,5 +1,5 @@ import { Inject, Injectable } from '@nestjs/common'; -import { Model } from 'mongoose'; +import mongoose, { Model } from 'mongoose'; import { CreateEventDto } from './dto/create-event.dto'; import { Event } from './entities/event.entity'; @@ -17,7 +17,9 @@ export class EventRepository { } findOne(eventId: string): Promise { - return this.eventModel.findById(eventId).exec() as Promise; + if (mongoose.Types.ObjectId.isValid(eventId)) { + return this.eventModel.findById(eventId).exec() as Promise; + } } update(eventId: string, event: Event): Promise {