File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -58,4 +58,20 @@ export class ReplayController {
58
58
}
59
59
}
60
60
61
+ @Get ( '/existence' )
62
+ @ApiOperation ( { summary : 'Get replay exited' , description : '다시보기에 대한 존재 여부를 반환 받습니다.' } )
63
+ async getExistence ( @Query ( 'videoId' ) videoId : string , @Res ( ) res : Response ) {
64
+ try {
65
+ const replaySessions = this . memoryDBService . findAll ( ) . filter ( ( info ) => info . replay ) ;
66
+ if ( replaySessions . some ( ( info ) => info . sessionKey === videoId ) ) {
67
+ res . status ( HttpStatus . OK ) . json ( { exited : true } ) ;
68
+ }
69
+ else {
70
+ res . status ( HttpStatus . OK ) . json ( { exited : false } ) ;
71
+ }
72
+ } catch ( err ) {
73
+ console . log ( err ) ;
74
+ res . status ( HttpStatus . INTERNAL_SERVER_ERROR ) . send ( ) ;
75
+ }
76
+ }
61
77
}
Original file line number Diff line number Diff line change @@ -99,4 +99,21 @@ export class StreamsController {
99
99
}
100
100
}
101
101
}
102
+
103
+ @Get ( '/existence' )
104
+ @ApiOperation ( { summary : 'Get Session exited' , description : '방송 세션에 대한 존재 여부를 반환 받습니다.' } )
105
+ async getExistence ( @Query ( 'sessionKey' ) sessionKey : string , @Res ( ) res : Response ) {
106
+ try {
107
+ const liveSessions = this . memoryDBService . findAll ( ) . filter ( ( info ) => info . state ) ;
108
+ if ( liveSessions . some ( ( info ) => info . sessionKey === sessionKey ) ) {
109
+ res . status ( HttpStatus . OK ) . json ( { exited : true } ) ;
110
+ }
111
+ else {
112
+ res . status ( HttpStatus . OK ) . json ( { exited : false } ) ;
113
+ }
114
+ } catch ( err ) {
115
+ console . log ( err ) ;
116
+ res . status ( HttpStatus . INTERNAL_SERVER_ERROR ) . send ( ) ;
117
+ }
118
+ }
102
119
}
You can’t perform that action at this time.
0 commit comments