Skip to content

Commit

Permalink
fix : error code
Browse files Browse the repository at this point in the history
  • Loading branch information
iqeq1945 committed Dec 3, 2024
1 parent 9300b5f commit 8704cf4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/room/room.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class RoomService {

async findById(id: string): Promise<Room> {
try {
return await this.prisma.room.findUnique({
let room = await this.prisma.room.findUnique({
where: { id },
include: {
users: {
Expand All @@ -102,6 +102,10 @@ export class RoomService {
},
},
});
if (room.users.length === 1 && room.start) {
room = await this.setStart(room.id, false);
}
return room;
} catch (error) {
if (error instanceof NotFoundException) throw error;
throw new BadRequestException('방을 찾는 중 오류가 발생했습니다.');
Expand Down

0 comments on commit 8704cf4

Please sign in to comment.