Skip to content

Commit 1eed969

Browse files
committed
fix bug slug
1 parent 7bc43a9 commit 1eed969

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

apps/room/src/room.service.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,15 @@ export class RoomService {
175175
{ path },
176176
'rooms',
177177
);
178-
if (!checkPath)
178+
if (!checkPath) {
179179
throw new HttpException('Invalid path', HttpStatus.BAD_REQUEST);
180-
checkPath.rooms.map((room) => {
181-
if (room.slug != slug) {
182-
throw new HttpException('Invalid slug', HttpStatus.BAD_REQUEST);
183-
}
184-
});
180+
}
181+
182+
const room = checkPath.rooms.find((room) => room.slug === slug);
183+
if (!room) {
184+
throw new HttpException('Invalid slug', HttpStatus.BAD_REQUEST);
185+
}
186+
185187
const data = await this.RoomRepository.findOneByCondition(
186188
{ slug },
187189
'roomType',

0 commit comments

Comments
 (0)