From 6d19741e4c457ddd8a52000d3a7e9d39bd68eedc Mon Sep 17 00:00:00 2001 From: vvandenb Date: Mon, 20 Mar 2023 17:32:28 +0100 Subject: [PATCH] * Fix --- .env_sample | 23 +++++++++++++++++++++++ Makefile | 2 +- back/volume/src/chat/chat.gateway.ts | 6 ++++-- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 .env_sample diff --git a/.env_sample b/.env_sample new file mode 100644 index 0000000..8b19e92 --- /dev/null +++ b/.env_sample @@ -0,0 +1,23 @@ +POSTGRES_HOST=postgres +POSTGRES_PORT=5432 +POSTGRES_USER=postgres_usr +POSTGRES_PASSWORD=postgres_pw +POSTGRES_DB=transcendence + +MAIL_USER=vaganiwast@gmail.com +MAIL_PASSWORD= + +FRONT_FPS=144 + +HOST=localhost +VITE_HOST=localhost +FRONT_PORT=80 +BACK_PORT=3001 +HASH_SALT=10 + +JWT_SECRET= +JWT_EXPIRATION_TIME=900 + +FT_OAUTH_CLIENT_ID= +FT_OAUTH_CLIENT_SECRET= +FT_OAUTH_CALLBACK_URL=http://localhost:3001/log/inReturn diff --git a/Makefile b/Makefile index 52915d4..e4d9e0b 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ USER = gavaniwast all: clean dev dev: - NODE_ENV="development" docker compose up --build + NODE_ENV="development" docker-compose up --build check: NODE_ENV="check" docker-compose run back --build diff --git a/back/volume/src/chat/chat.gateway.ts b/back/volume/src/chat/chat.gateway.ts index f6ced76..2c0c793 100644 --- a/back/volume/src/chat/chat.gateway.ts +++ b/back/volume/src/chat/chat.gateway.ts @@ -20,6 +20,7 @@ import ConnectedUser from './entity/connection.entity'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import type User from 'src/users/entity/user.entity'; +import Channel from './entity/channel.entity'; @WebSocketGateway({ cors: { @@ -106,8 +107,9 @@ export class ChatGateway implements OnGatewayConnection, OnGatewayDisconnect { } @SubscribeMessage('addMessage') - async onAddMessage(socket: Socket, message: CreateMessageDto): Promise { - const channel = await this.chatService.getChannel(message.ChannelId); + async onAddMessage (socket: Socket, message: CreateMessageDto): Promise { + let channel: Channel | null = null + channel = await this.chatService.getChannel(message.ChannelId).catch(() => { return null }) if (channel == null) { this.server.to(socket.id).emit('kicked') throw new WsException('Channel has been removed by owner');