Browse Source

* Fix

master
vvandenb 2 years ago
parent
commit
6d19741e4c
  1. 23
      .env_sample
  2. 2
      Makefile
  3. 6
      back/volume/src/chat/chat.gateway.ts

23
.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

2
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

6
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<void> {
const channel = await this.chatService.getChannel(message.ChannelId);
async onAddMessage (socket: Socket, message: CreateMessageDto): Promise<void> {
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');

Loading…
Cancel
Save