Skip to content

Commit

Permalink
fix: 5b12d34
Browse files Browse the repository at this point in the history
  • Loading branch information
ssoxong committed May 1, 2024
1 parent 5b12d34 commit 537da01
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/event/event.repository.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -17,7 +17,9 @@ export class EventRepository {
}

findOne(eventId: string): Promise<Event> {
return this.eventModel.findById(eventId).exec() as Promise<Event>;
if (mongoose.Types.ObjectId.isValid(eventId)) {
return this.eventModel.findById(eventId).exec() as Promise<Event>;
}
}

update(eventId: string, event: Event): Promise<Event> {
Expand Down

0 comments on commit 537da01

Please sign in to comment.