From 77cc0204e6ecda24db9851996c7c895aec339bbb Mon Sep 17 00:00:00 2001 From: Pheuw1 Date: Sat, 18 Mar 2023 20:46:26 +0100 Subject: [PATCH] store for ChatOpen & few changes to front and back sockets --- back/volume/src/chat/chat.gateway.ts | 4 ++- back/volume/src/users/entity/user.entity.ts | 3 ++- front/volume/src/App.svelte | 5 +++- .../volume/src/components/Alert/Alert.svelte | 4 +++ front/volume/src/components/Alert/content.ts | 3 ++- front/volume/src/components/Channels.svelte | 27 ++++++++++++++++--- front/volume/src/components/Chat.svelte | 24 +++++------------ 7 files changed, 46 insertions(+), 24 deletions(-) diff --git a/back/volume/src/chat/chat.gateway.ts b/back/volume/src/chat/chat.gateway.ts index f645561..c3c08d2 100644 --- a/back/volume/src/chat/chat.gateway.ts +++ b/back/volume/src/chat/chat.gateway.ts @@ -61,7 +61,8 @@ export class ChatGateway implements OnGatewayConnection, OnGatewayDisconnect { ) { throw new WsException('Wrong password') } - } else await this.chatService.addUserToChannel(channel, user) + } + await this.chatService.addUserToChannel(channel, user) const messages = await this.messageService.findMessagesInChannelForUser( channel, user @@ -93,6 +94,7 @@ export class ChatGateway implements OnGatewayConnection, OnGatewayDisconnect { const connect = await this.connectedUserRepository.findOneBy({ socket: socket.id }) + console.log("connection removed", connect?.user) if (connect == null) return const channel = await this.chatService.getFullChannel(connect.channel) socket.disconnect() diff --git a/back/volume/src/users/entity/user.entity.ts b/back/volume/src/users/entity/user.entity.ts index 077184e..ca9eef6 100644 --- a/back/volume/src/users/entity/user.entity.ts +++ b/back/volume/src/users/entity/user.entity.ts @@ -1,4 +1,5 @@ -import { Entity, +import { + Entity, PrimaryGeneratedColumn, Column, ManyToMany, diff --git a/front/volume/src/App.svelte b/front/volume/src/App.svelte index b72994f..98d6859 100644 --- a/front/volume/src/App.svelte +++ b/front/volume/src/App.svelte @@ -14,6 +14,7 @@