From 19b41d750fb1b435278c653eec022e7ed1a195cf Mon Sep 17 00:00:00 2001 From: Yu NaHyun Date: Fri, 29 Dec 2023 11:01:11 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=9A=91=20::=20hotfix=20::=20jwt=20exc?= =?UTF-8?q?eption=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/chat.gateway.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/chat/chat.gateway.ts b/src/chat/chat.gateway.ts index 3a14147..9bfeef9 100644 --- a/src/chat/chat.gateway.ts +++ b/src/chat/chat.gateway.ts @@ -1,3 +1,4 @@ +import { UnauthorizedException } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { SubscribeMessage, @@ -34,6 +35,8 @@ export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa // JWT 유효성 검사 const { userID } = await this.userService.validateAccess(socket.handshake.headers.authorization); + if(!userID) throw new UnauthorizedException() + // 유저가 속한 채팅방 찾기 const groupList = await this.groupMappingEntity.findBy({ userID }); @@ -60,9 +63,9 @@ export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa message: string, room: string }): Promise { - const thisUser = (await this.userService.validateAccess(client.client.request.headers.authorization)).userID + const { userID } = (await this.userService.validateAccess(client.client.request.headers.authorization)) this.server.to(data.room).emit('message', { - userID: thisUser, + userID, message: data.message, room: data.room }) From 5af88ce642c780f96d1e4ffd4d361c88ef9c35cb Mon Sep 17 00:00:00 2001 From: Yu NaHyun Date: Fri, 29 Dec 2023 16:09:15 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=91=80=20::=20chore=20::=20patch=20re?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dump.rdb | Bin 0 -> 1230 bytes src/chat/chat.service.ts | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 dump.rdb diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 0000000000000000000000000000000000000000..251dbc268039b511d86ac9dd067d74a43b9cdc84 GIT binary patch literal 1230 zcmb``O>Wvi6u@zBQl(Y0=s`gKzyzzC7;Nwm#$OnJZ4ivd*kg<#28=EB3cX3C9wCa< zO>fXeFG8fYR=P`+O=0`=M*8WmH>NCsF-UZT@h3 zyg=JH#gCuXU-0pAm*b$3;`H&`&yUpca+ZaS`7Fl|)NktP9YtNSB0@ONtt`Q-+poAB zM)LuRwRi|76=2jDVBdc!4F#QMF=K?$~0X;G-wQfM}qe$;2oh3};T zw>3v9;nE%LbtAMP@6_MZ#yhtuox16$9Pg1Y8R9NyzR`v3H2(YK(44$u0o zA@XZ|?RJFRmLj+1RZGPIaF!;rSMIh>*s|Jre?qzvq^_7#)61{Yd#;-JZ>6`AgJy~4 z%k)t4Dk#-Qsm;~lstSN68iBUMqd{h421DggNK;u^yL7&jU4^zf9-^+9lhdC?&#A%X}NCqI4scZIR{W<=uQPl0}=RZp< uMK8F8KedDIdMbB#i;*}WutxW8qxbbp5C(0o)W#?j|9t;t|M02LPk#Z-!=~r} literal 0 HcmV?d00001 diff --git a/src/chat/chat.service.ts b/src/chat/chat.service.ts index c92a49e..1f78715 100644 --- a/src/chat/chat.service.ts +++ b/src/chat/chat.service.ts @@ -340,9 +340,12 @@ export class ChatService { .orderBy('isManager', 'DESC') .getRawMany(); + const isOrganization: boolean = count.length == 2 ? false: true + return { thisGroup, member: count, + isOrganization }; } From 5900dfb43358a79f936159568e7ae8ddc157afe2 Mon Sep 17 00:00:00 2001 From: Yu NaHyun Date: Fri, 29 Dec 2023 16:26:09 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=91=80=20::=20chore=20::=20patch=20re?= =?UTF-8?q?sponse=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/profile/profile.service.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/profile/profile.service.ts b/src/profile/profile.service.ts index 34fed47..84ae434 100644 --- a/src/profile/profile.service.ts +++ b/src/profile/profile.service.ts @@ -37,10 +37,10 @@ export class ProfileService { const thisUser = await this.userEntity.findOneBy({ userID }); const thisStudent = await this.studentEntity.findOneBy({ userID }); - let isOnline = 0; + let isOnline = false; if (!thisUser || !thisStudent) throw new NotFoundException('존재하지 않는 유저'); - if(await this.redis.get(`${userID}AccessToken`)) isOnline = 1 + if(await this.redis.get(`${userID}AccessToken`)) isOnline = true return Object.assign(thisUser, thisStudent, {isOnline}); } @@ -173,10 +173,10 @@ export class ProfileService { const thisUser = await this.userEntity.findOneBy({ userID }); const thisTeacher = await this.teacherEntity.findOneBy({ userID }); - let isOnline = 0; + let isOnline = false; if (!thisUser || !thisTeacher) throw new NotFoundException('존재하지 않는 유저'); - if(await this.redis.get(`${userID}AccessToken`)) isOnline = 1 + if(await this.redis.get(`${userID}AccessToken`)) isOnline = true return Object.assign(thisUser, thisTeacher, {isOnline}); }