Skip to content

Commit

Permalink
Merge pull request #255 from boostcampwm-2024/dev-be
Browse files Browse the repository at this point in the history
[CICD]
  • Loading branch information
i3kae authored Nov 30, 2024
2 parents 2cdefaa + e875777 commit bfc36cf
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions backend/mainServer/src/replay/replay.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,20 @@ export class ReplayController {
}
}

@Get('/existence')
@ApiOperation({summary: 'Get replay exited', description: '다시보기에 대한 존재 여부를 반환 받습니다.'})
async getExistence(@Query('videoId') videoId: string, @Res() res: Response) {
try {
const replaySessions = this.memoryDBService.findAll().filter((info) => info.replay);
if (replaySessions.some((info) => info.sessionKey === videoId)) {
res.status(HttpStatus.OK).json({exited: true});
}
else {
res.status(HttpStatus.OK).json({exited: false});
}
} catch (err) {
console.log(err);
res.status(HttpStatus.INTERNAL_SERVER_ERROR).send();
}
}
}
17 changes: 17 additions & 0 deletions backend/mainServer/src/streams/streams.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,21 @@ export class StreamsController {
}
}
}

@Get('/existence')
@ApiOperation({summary: 'Get Session exited', description: '방송 세션에 대한 존재 여부를 반환 받습니다.'})
async getExistence(@Query('sessionKey') sessionKey: string, @Res() res: Response) {
try {
const liveSessions = this.memoryDBService.findAll().filter((info) => info.state);
if (liveSessions.some((info) => info.sessionKey === sessionKey)) {
res.status(HttpStatus.OK).json({exited: true});
}
else {
res.status(HttpStatus.OK).json({exited: false});
}
} catch (err) {
console.log(err);
res.status(HttpStatus.INTERNAL_SERVER_ERROR).send();
}
}
}

0 comments on commit bfc36cf

Please sign in to comment.