@@ -26,7 +26,12 @@ export class ConnectionService {
2626 * uuidλ₯Ό κΈ°λ°μΌλ‘ λ°©μ μμ±νκ³ μ μ₯νλ λ©μλμ
λλ€.
2727 * @returns uuid - λ°©μ uuid
2828 */
29- async createRoom ( ) {
29+ async createRoom ( client : Socket ) {
30+ const exception = await this . isEnterableClient ( client . data . authId ) ;
31+ if ( exception ) {
32+ return exception ;
33+ }
34+
3035 const defaultRoom = this . createDefaultRoom ( ) ;
3136 const room = await this . roomRepository . createRoom ( {
3237 roomUUID : defaultRoom . roomUUID ,
@@ -45,7 +50,7 @@ export class ConnectionService {
4550 async enterRoom ( { client, roomUUID } : { client : Socket ; roomUUID : string } ) {
4651 const room = await this . roomRepository . getRoom ( roomUUID ) ;
4752
48- const exception = await this . isEnterable ( { client, room } ) ;
53+ const exception = await this . isEnterable ( { authId : client . data . userId , room } ) ;
4954 if ( exception ) return exception ;
5055
5156 const user = await this . createDefaultUser ( { client, roomUUID } ) ;
@@ -66,8 +71,8 @@ export class ConnectionService {
6671 * clientκ° λ€μ΄κ° μ μλμ§ & roomμ΄ νμ¬ λ€μ΄κ° μ μλ μν©μΈμ§ 체ν¬νλ λ©μλμ
λλ€.
6772 * @returns
6873 */
69- async isEnterable ( { client , room } : { client : Socket ; room : Room } ) {
70- return ( await this . isEnterableClient ( client ) ) ?? ( await this . isEnterableRoom ( room ) ) ?? null ;
74+ async isEnterable ( { authId , room } : { authId : string ; room : Room } ) {
75+ return ( await this . isEnterableClient ( authId ) ) ?? ( await this . isEnterableRoom ( room ) ) ?? null ;
7176 }
7277
7378 /**
@@ -94,12 +99,12 @@ export class ConnectionService {
9499 }
95100
96101 /**
97- * ν΄λΉ socket clientκ° interviewμ μ°Έμν μ μλμ§ μ²΄ν¬νλ λ©μλμ
λλ€.
98- * @param client
102+ * νμμ΄ interviewμ μ°Έμν μ μλμ§ μ²΄ν¬νλ λ©μλμ
λλ€.
103+ * @param authId
99104 * @returns
100105 */
101- async isEnterableClient ( client : Socket ) {
102- const prevUser = await this . roomRepository . getUserIdByAuthId ( client . data . authId ) ;
106+ async isEnterableClient ( authId : string ) {
107+ const prevUser = await this . roomRepository . getUserIdByAuthId ( authId ) ;
103108 if ( prevUser ) {
104109 return { success : false , message : SOCKET_MESSAGE . EXIST_SAME_AUTH_ID } ;
105110 }
0 commit comments