From 2411261da5ad32cfeb2f010af6d473b64b134b81 Mon Sep 17 00:00:00 2001 From: nicolas-arnaud Date: Tue, 21 Mar 2023 18:03:23 +0100 Subject: [PATCH] simplified structure --- .env_sample | 35 +++++---- .gitattributes | 6 ++ Makefile | 2 +- Makesudo | 14 ++-- back.dockerfile | 5 ++ back/{volume => }/.eslintrc.js | 0 back/{volume => }/.gitignore | 0 back/Dockerfile | 10 --- back/entrypoint.sh | 31 -------- back/{volume => }/nest-cli.json | 0 back/{volume => }/package-lock.json | 0 back/{volume => }/package.json | 0 back/src/app.module.ts | 36 +++++++++ back/{volume => }/src/auth/42-auth.guard.ts | 0 back/{volume => }/src/auth/42.decorator.ts | 0 back/{volume => }/src/auth/42.strategy.ts | 7 +- back/{volume => }/src/auth/auth.controller.ts | 0 back/{volume => }/src/auth/auth.module.ts | 0 back/{volume => }/src/auth/auth.service.ts | 0 back/{volume => }/src/auth/mails/confirm.hbs | 0 .../{volume => }/src/auth/mails/confirmed.hbs | 0 .../src/auth/session.serializer.ts | 0 back/{volume => }/src/chat/chat.controller.ts | 3 + back/{volume => }/src/chat/chat.gateway.ts | 2 +- back/{volume => }/src/chat/chat.module.ts | 0 back/{volume => }/src/chat/chat.service.ts | 0 .../src/chat/dto/connection.dto.ts | 0 .../src/chat/dto/create-channel.dto.ts | 0 .../src/chat/dto/create-message.dto.ts | 0 .../{volume => }/src/chat/dto/kickUser.dto.ts | 0 .../src/chat/dto/update-channel.dto.ts | 0 .../src/chat/dto/updateUser.dto.ts | 0 .../src/chat/entity/channel.entity.ts | 0 .../src/chat/entity/connection.entity.ts | 0 .../{volume => }/src/chat/entity/dm.entity.ts | 0 .../src/chat/entity/message.entity.ts | 0 back/{volume => }/src/chat/message.service.ts | 0 back/{volume => }/src/main.ts | 0 .../src/pong/dtos/GameCreationDtoValidated.ts | 0 back/{volume => }/src/pong/dtos/GameInfo.ts | 0 back/{volume => }/src/pong/dtos/GameUpdate.ts | 0 .../src/pong/dtos/MapDtoValidated.ts | 0 .../src/pong/dtos/MatchmakingDto.ts | 0 .../src/pong/dtos/MatchmakingDtoValidated.ts | 0 .../src/pong/dtos/PointDtoValidated.ts | 0 .../src/pong/dtos/RectDtoValidated.ts | 0 back/{volume => }/src/pong/dtos/StringDto.ts | 0 .../src/pong/dtos/StringDtoValidated.ts | 0 back/{volume => }/src/pong/dtos/UserDto.ts | 0 .../src/pong/entity/result.entity.ts | 0 back/{volume => }/src/pong/game/Ball.ts | 0 back/{volume => }/src/pong/game/Game.ts | 0 back/{volume => }/src/pong/game/Games.ts | 0 .../src/pong/game/MatchmakingQueue.ts | 0 back/{volume => }/src/pong/game/Paddle.ts | 0 back/{volume => }/src/pong/game/Player.ts | 0 back/{volume => }/src/pong/game/constants.ts | 0 back/{volume => }/src/pong/game/utils.ts | 0 back/{volume => }/src/pong/pong.controller.ts | 0 back/{volume => }/src/pong/pong.gateway.ts | 0 back/{volume => }/src/pong/pong.module.ts | 0 back/{volume => }/src/pong/pong.service.ts | 0 back/{volume => }/src/types.d.ts | 0 back/{volume => }/src/users/dto/user.dto.ts | 0 .../src/users/entity/user.entity.ts | 0 .../src/users/users.controller.ts | 0 back/{volume => }/src/users/users.module.ts | 0 back/{volume => }/src/users/users.service.ts | 0 back/{volume => }/tsconfig.build.json | 0 back/{volume => }/tsconfig.json | 0 back/volume/README.md | 73 ------------------ back/volume/src/app.module.ts | 53 ------------- docker-compose.yml | 12 ++- front/Dockerfile => front.dockerfile | 5 +- front/{volume => }/.gitignore | 0 front/entrypoint.sh | 13 ---- front/{volume => }/index.html | 0 front/{volume => }/package-lock.json | 0 front/{volume => }/package.json | 0 front/{volume => }/public/audio/edge_hit.wav | Bin .../{volume => }/public/audio/paddle_hit.wav | Bin front/{volume => }/public/audio/score.wav | Bin front/{volume => }/public/global.css | 0 front/{volume => }/public/img/chat.png | Bin front/{volume => }/public/img/close.png | Bin front/{volume => }/public/img/pog.jpg | Bin front/{volume => }/public/img/pong.png | Bin front/{volume => }/public/img/send.png | Bin front/{volume => }/public/vite.svg | 0 front/{volume => }/src/App.svelte | 0 front/{volume => }/src/Auth.ts | 0 front/{volume => }/src/app.d.ts | 0 .../src/components/Alert/Alert.svelte | 0 .../src/components/Alert/content.ts | 0 .../src/components/Channels.svelte | 11 ++- front/{volume => }/src/components/Chat.svelte | 6 +- .../src/components/Friends.svelte | 0 .../src/components/Leaderboard.svelte | 0 .../src/components/MatchHistory.svelte | 0 .../{volume => }/src/components/NavBar.svelte | 8 +- .../{volume => }/src/components/Pong/Ball.ts | 0 .../src/components/Pong/ColorPicker.svelte | 0 .../{volume => }/src/components/Pong/Game.ts | 3 +- .../src/components/Pong/GameComponent.svelte | 0 .../src/components/Pong/GameCreation.svelte | 0 front/{volume => }/src/components/Pong/Map.ts | 0 .../components/Pong/MapCustomization.svelte | 0 .../src/components/Pong/Matchmaking.svelte | 0 .../src/components/Pong/Paddle.ts | 0 .../src/components/Pong/Player.ts | 0 .../src/components/Pong/Pong.svelte | 8 +- .../src/components/Pong/constants.ts | 0 .../components/Pong/dtos/GameCreationDto.ts | 0 .../src/components/Pong/dtos/GameInfo.ts | 0 .../src/components/Pong/dtos/GameUpdate.ts | 0 .../components/Pong/dtos/MatchmakingDto.ts | 0 .../src/components/Pong/dtos/StringDto.ts | 0 .../{volume => }/src/components/Pong/utils.ts | 0 .../src/components/Profile.svelte | 0 .../src/components/infiniteScroll.svelte | 0 front/{volume => }/src/main.ts | 0 front/{volume => }/src/vite-env.d.ts | 0 front/{volume => }/svelte.config.js | 0 front/{volume => }/tsconfig.json | 0 front/{volume => }/tsconfig.node.json | 0 front/{volume => }/vite.config.ts | 0 front/volume/.gitattributes | 3 - front/volume/src/global.d.ts | 5 -- ...vite.config.ts.timestamp-1676885224890.mjs | 13 ---- 129 files changed, 107 insertions(+), 257 deletions(-) create mode 100644 .gitattributes create mode 100644 back.dockerfile rename back/{volume => }/.eslintrc.js (100%) rename back/{volume => }/.gitignore (100%) delete mode 100644 back/Dockerfile delete mode 100644 back/entrypoint.sh rename back/{volume => }/nest-cli.json (100%) rename back/{volume => }/package-lock.json (100%) rename back/{volume => }/package.json (100%) create mode 100644 back/src/app.module.ts rename back/{volume => }/src/auth/42-auth.guard.ts (100%) rename back/{volume => }/src/auth/42.decorator.ts (100%) rename back/{volume => }/src/auth/42.strategy.ts (84%) rename back/{volume => }/src/auth/auth.controller.ts (100%) rename back/{volume => }/src/auth/auth.module.ts (100%) rename back/{volume => }/src/auth/auth.service.ts (100%) rename back/{volume => }/src/auth/mails/confirm.hbs (100%) rename back/{volume => }/src/auth/mails/confirmed.hbs (100%) rename back/{volume => }/src/auth/session.serializer.ts (100%) rename back/{volume => }/src/chat/chat.controller.ts (98%) rename back/{volume => }/src/chat/chat.gateway.ts (98%) rename back/{volume => }/src/chat/chat.module.ts (100%) rename back/{volume => }/src/chat/chat.service.ts (100%) rename back/{volume => }/src/chat/dto/connection.dto.ts (100%) rename back/{volume => }/src/chat/dto/create-channel.dto.ts (100%) rename back/{volume => }/src/chat/dto/create-message.dto.ts (100%) rename back/{volume => }/src/chat/dto/kickUser.dto.ts (100%) rename back/{volume => }/src/chat/dto/update-channel.dto.ts (100%) rename back/{volume => }/src/chat/dto/updateUser.dto.ts (100%) rename back/{volume => }/src/chat/entity/channel.entity.ts (100%) rename back/{volume => }/src/chat/entity/connection.entity.ts (100%) rename back/{volume => }/src/chat/entity/dm.entity.ts (100%) rename back/{volume => }/src/chat/entity/message.entity.ts (100%) rename back/{volume => }/src/chat/message.service.ts (100%) rename back/{volume => }/src/main.ts (100%) rename back/{volume => }/src/pong/dtos/GameCreationDtoValidated.ts (100%) rename back/{volume => }/src/pong/dtos/GameInfo.ts (100%) rename back/{volume => }/src/pong/dtos/GameUpdate.ts (100%) rename back/{volume => }/src/pong/dtos/MapDtoValidated.ts (100%) rename back/{volume => }/src/pong/dtos/MatchmakingDto.ts (100%) rename back/{volume => }/src/pong/dtos/MatchmakingDtoValidated.ts (100%) rename back/{volume => }/src/pong/dtos/PointDtoValidated.ts (100%) rename back/{volume => }/src/pong/dtos/RectDtoValidated.ts (100%) rename back/{volume => }/src/pong/dtos/StringDto.ts (100%) rename back/{volume => }/src/pong/dtos/StringDtoValidated.ts (100%) rename back/{volume => }/src/pong/dtos/UserDto.ts (100%) rename back/{volume => }/src/pong/entity/result.entity.ts (100%) rename back/{volume => }/src/pong/game/Ball.ts (100%) rename back/{volume => }/src/pong/game/Game.ts (100%) rename back/{volume => }/src/pong/game/Games.ts (100%) rename back/{volume => }/src/pong/game/MatchmakingQueue.ts (100%) rename back/{volume => }/src/pong/game/Paddle.ts (100%) rename back/{volume => }/src/pong/game/Player.ts (100%) rename back/{volume => }/src/pong/game/constants.ts (100%) rename back/{volume => }/src/pong/game/utils.ts (100%) rename back/{volume => }/src/pong/pong.controller.ts (100%) rename back/{volume => }/src/pong/pong.gateway.ts (100%) rename back/{volume => }/src/pong/pong.module.ts (100%) rename back/{volume => }/src/pong/pong.service.ts (100%) rename back/{volume => }/src/types.d.ts (100%) rename back/{volume => }/src/users/dto/user.dto.ts (100%) rename back/{volume => }/src/users/entity/user.entity.ts (100%) rename back/{volume => }/src/users/users.controller.ts (100%) rename back/{volume => }/src/users/users.module.ts (100%) rename back/{volume => }/src/users/users.service.ts (100%) rename back/{volume => }/tsconfig.build.json (100%) rename back/{volume => }/tsconfig.json (100%) delete mode 100644 back/volume/README.md delete mode 100644 back/volume/src/app.module.ts rename front/Dockerfile => front.dockerfile (51%) rename front/{volume => }/.gitignore (100%) delete mode 100644 front/entrypoint.sh rename front/{volume => }/index.html (100%) rename front/{volume => }/package-lock.json (100%) rename front/{volume => }/package.json (100%) rename front/{volume => }/public/audio/edge_hit.wav (100%) rename front/{volume => }/public/audio/paddle_hit.wav (100%) rename front/{volume => }/public/audio/score.wav (100%) rename front/{volume => }/public/global.css (100%) rename front/{volume => }/public/img/chat.png (100%) rename front/{volume => }/public/img/close.png (100%) rename front/{volume => }/public/img/pog.jpg (100%) rename front/{volume => }/public/img/pong.png (100%) rename front/{volume => }/public/img/send.png (100%) rename front/{volume => }/public/vite.svg (100%) rename front/{volume => }/src/App.svelte (100%) rename front/{volume => }/src/Auth.ts (100%) rename front/{volume => }/src/app.d.ts (100%) rename front/{volume => }/src/components/Alert/Alert.svelte (100%) rename front/{volume => }/src/components/Alert/content.ts (100%) rename front/{volume => }/src/components/Channels.svelte (98%) rename front/{volume => }/src/components/Chat.svelte (99%) rename front/{volume => }/src/components/Friends.svelte (100%) rename front/{volume => }/src/components/Leaderboard.svelte (100%) rename front/{volume => }/src/components/MatchHistory.svelte (100%) rename front/{volume => }/src/components/NavBar.svelte (95%) rename front/{volume => }/src/components/Pong/Ball.ts (100%) rename front/{volume => }/src/components/Pong/ColorPicker.svelte (100%) rename front/{volume => }/src/components/Pong/Game.ts (99%) rename front/{volume => }/src/components/Pong/GameComponent.svelte (100%) rename front/{volume => }/src/components/Pong/GameCreation.svelte (100%) rename front/{volume => }/src/components/Pong/Map.ts (100%) rename front/{volume => }/src/components/Pong/MapCustomization.svelte (100%) rename front/{volume => }/src/components/Pong/Matchmaking.svelte (100%) rename front/{volume => }/src/components/Pong/Paddle.ts (100%) rename front/{volume => }/src/components/Pong/Player.ts (100%) rename front/{volume => }/src/components/Pong/Pong.svelte (97%) rename front/{volume => }/src/components/Pong/constants.ts (100%) rename front/{volume => }/src/components/Pong/dtos/GameCreationDto.ts (100%) rename front/{volume => }/src/components/Pong/dtos/GameInfo.ts (100%) rename front/{volume => }/src/components/Pong/dtos/GameUpdate.ts (100%) rename front/{volume => }/src/components/Pong/dtos/MatchmakingDto.ts (100%) rename front/{volume => }/src/components/Pong/dtos/StringDto.ts (100%) rename front/{volume => }/src/components/Pong/utils.ts (100%) rename front/{volume => }/src/components/Profile.svelte (100%) rename front/{volume => }/src/components/infiniteScroll.svelte (100%) rename front/{volume => }/src/main.ts (100%) rename front/{volume => }/src/vite-env.d.ts (100%) rename front/{volume => }/svelte.config.js (100%) rename front/{volume => }/tsconfig.json (100%) rename front/{volume => }/tsconfig.node.json (100%) rename front/{volume => }/vite.config.ts (100%) delete mode 100644 front/volume/.gitattributes delete mode 100644 front/volume/src/global.d.ts delete mode 100644 front/volume/vite.config.ts.timestamp-1676885224890.mjs diff --git a/.env_sample b/.env_sample index 8b19e92..eed2260 100644 --- a/.env_sample +++ b/.env_sample @@ -1,23 +1,30 @@ -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 - +### BACK ### HOST=localhost -VITE_HOST=localhost FRONT_PORT=80 BACK_PORT=3001 HASH_SALT=10 -JWT_SECRET= -JWT_EXPIRATION_TIME=900 +### FRONT ### +VITE_HOST=localhost +VITE_BACK_PORT=3001 + +### GAME ### +VITE_FRONT_FPS=144 + +### 2FA ### +MAIL_USER=vaganiwast@gmail.com +MAIL_PASSWORD= +### AUTH ### FT_OAUTH_CLIENT_ID= FT_OAUTH_CLIENT_SECRET= FT_OAUTH_CALLBACK_URL=http://localhost:3001/log/inReturn +JWT_SECRET=test +JWT_EXPIRATION_TIME=900 + +### DB ### +POSTGRES_HOST=postgres +POSTGRES_PORT=5432 +POSTGRES_USER=postgres_usr +POSTGRES_PASSWORD=postgres_pw +POSTGRES_DB=transcendence diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..23fe8b9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +*.ts text=auto eol=lf +*.svelte text=auto eol=lf +*.yml text=auto eol=lf +*.json text=auto eol=lf +*.html text=auto eol=lf +*.xml text=auto eol=lf diff --git a/Makefile b/Makefile index 5de3299..7d65c9e 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ clean: stop docker system prune -f fclean: stop - rm -rf */volume/node_modules + rm -rf */node_modules docker system prune -af --volumes re: fclean dev diff --git a/Makesudo b/Makesudo index 3e29cd4..98cb570 100644 --- a/Makesudo +++ b/Makesudo @@ -4,27 +4,27 @@ USER = gavaniwast all: clean dev prod: - sudo NODE_ENV="production" docker compose -f docker-compose.yml up --build + sudo docker-compose up --build dev: - sudo NODE_ENV="development" docker compose -f docker-compose.yml up --build + sudo docker-compose up --build check: - sudo NODE_ENV="check" docker compose -f docker-compose.yml run back --build - sudo NODE_ENV="check" docker compose -f docker-compose.yml run front --build + sudo NODE_ENV="check" docker-compose run back --build + sudo NODE_ENV="check" docker-compose run front --build sudo docker compose -f docker-compose.yml down debug: - sudo NODE_ENV="debug" BUILDKIT_PROGRESS=plain docker compose -f docker-compose.yml up --build + sudo NODE_ENV="debug" BUILDKIT_PROGRESS=plain docker-compose up --build stop: - sudo docker compose -f docker-compose.yml down + sudo docker-compose down clean: stop sudo docker system prune -f fclean: stop - rm */volume/node_modules + sudo rm -rf */node_modules sudo docker system prune -af --volumes re: fclean dev diff --git a/back.dockerfile b/back.dockerfile new file mode 100644 index 0000000..2040078 --- /dev/null +++ b/back.dockerfile @@ -0,0 +1,5 @@ +FROM alpine:3.15 + +RUN apk update && apk upgrade && apk add npm && npm install -g @nestjs/cli +WORKDIR /var/www/html +ENTRYPOINT npm install && npm run dev diff --git a/back/volume/.eslintrc.js b/back/.eslintrc.js similarity index 100% rename from back/volume/.eslintrc.js rename to back/.eslintrc.js diff --git a/back/volume/.gitignore b/back/.gitignore similarity index 100% rename from back/volume/.gitignore rename to back/.gitignore diff --git a/back/Dockerfile b/back/Dockerfile deleted file mode 100644 index ceb911c..0000000 --- a/back/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM alpine:3.15 - -RUN apk update && apk upgrade && apk add npm \ - && npm install -g @nestjs/cli - - -WORKDIR /var/www/html - -COPY entrypoint.sh /tmp/entrypoint.sh -ENTRYPOINT ["sh", "/tmp/entrypoint.sh"] diff --git a/back/entrypoint.sh b/back/entrypoint.sh deleted file mode 100644 index 439a19e..0000000 --- a/back/entrypoint.sh +++ /dev/null @@ -1,31 +0,0 @@ -npm install; -cat >.env < ({ + type: 'postgres', + host: process.env.POSTGRES_HOST || 'localhost', + port: (process.env.POSTGRES_PORT || 5432) as number, + username: process.env.POSTGRES_USER || 'postgres', + password: process.env.POSTGRES_PASSWORD || 'postgres', + database: process.env.POSTGRES_DB || 'postgres', + jwt_secret: process.env.JWT_SECRET || 'secret', + autoLoadEntities: true, + synchronize: true + }) + }), + AuthModule, + ChatModule, + PongModule, + UsersModule + ] +}) +export class AppModule {} diff --git a/back/volume/src/auth/42-auth.guard.ts b/back/src/auth/42-auth.guard.ts similarity index 100% rename from back/volume/src/auth/42-auth.guard.ts rename to back/src/auth/42-auth.guard.ts diff --git a/back/volume/src/auth/42.decorator.ts b/back/src/auth/42.decorator.ts similarity index 100% rename from back/volume/src/auth/42.decorator.ts rename to back/src/auth/42.decorator.ts diff --git a/back/volume/src/auth/42.strategy.ts b/back/src/auth/42.strategy.ts similarity index 84% rename from back/volume/src/auth/42.strategy.ts rename to back/src/auth/42.strategy.ts index 7842580..5b02f7d 100644 --- a/back/volume/src/auth/42.strategy.ts +++ b/back/src/auth/42.strategy.ts @@ -11,13 +11,12 @@ import { User } from 'src/users/entity/user.entity' @Injectable() export class FtStrategy extends PassportStrategy(Strategy, '42') { constructor ( - private readonly configService: ConfigService, private readonly usersService: UsersService ) { super({ - clientID: configService.get('FT_OAUTH_CLIENT_ID'), - clientSecret: configService.get('FT_OAUTH_CLIENT_SECRET'), - callbackURL: configService.get('FT_OAUTH_CALLBACK_URL'), + clientID: process.env.FT_OAUTH_CLIENT_ID, + clientSecret: process.env.FT_OAUTH_CLIENT_SECRET, + callbackURL: process.env.FT_OAUTH_CALLBACK_URL, passReqToCallback: true }) } diff --git a/back/volume/src/auth/auth.controller.ts b/back/src/auth/auth.controller.ts similarity index 100% rename from back/volume/src/auth/auth.controller.ts rename to back/src/auth/auth.controller.ts diff --git a/back/volume/src/auth/auth.module.ts b/back/src/auth/auth.module.ts similarity index 100% rename from back/volume/src/auth/auth.module.ts rename to back/src/auth/auth.module.ts diff --git a/back/volume/src/auth/auth.service.ts b/back/src/auth/auth.service.ts similarity index 100% rename from back/volume/src/auth/auth.service.ts rename to back/src/auth/auth.service.ts diff --git a/back/volume/src/auth/mails/confirm.hbs b/back/src/auth/mails/confirm.hbs similarity index 100% rename from back/volume/src/auth/mails/confirm.hbs rename to back/src/auth/mails/confirm.hbs diff --git a/back/volume/src/auth/mails/confirmed.hbs b/back/src/auth/mails/confirmed.hbs similarity index 100% rename from back/volume/src/auth/mails/confirmed.hbs rename to back/src/auth/mails/confirmed.hbs diff --git a/back/volume/src/auth/session.serializer.ts b/back/src/auth/session.serializer.ts similarity index 100% rename from back/volume/src/auth/session.serializer.ts rename to back/src/auth/session.serializer.ts diff --git a/back/volume/src/chat/chat.controller.ts b/back/src/chat/chat.controller.ts similarity index 98% rename from back/volume/src/chat/chat.controller.ts rename to back/src/chat/chat.controller.ts index 019f073..d78272c 100644 --- a/back/volume/src/chat/chat.controller.ts +++ b/back/src/chat/chat.controller.ts @@ -121,6 +121,9 @@ export class ChatController { @Profile42() profile: Profile ): Promise { const channel = await this.channelService.getFullChannel(id) + if (await this.channelService.isOwner(channel.id, target.id)) { + throw new BadRequestException('The owner cannot be demoted') + } if (!(await this.channelService.isOwner(channel.id, +profile.id))) { throw new BadRequestException('You are not the owner of this channel') } diff --git a/back/volume/src/chat/chat.gateway.ts b/back/src/chat/chat.gateway.ts similarity index 98% rename from back/volume/src/chat/chat.gateway.ts rename to back/src/chat/chat.gateway.ts index 79062ae..ddc4cb0 100644 --- a/back/volume/src/chat/chat.gateway.ts +++ b/back/src/chat/chat.gateway.ts @@ -84,7 +84,7 @@ export class ChatGateway implements OnGatewayConnection, OnGatewayDisconnect { conUser.user = user.ftId; conUser.channel = channel.id; conUser.socket = socket.id; - const test = await this.connectedUserRepository.save(conUser); + await this.connectedUserRepository.save(conUser); await socket.join(channel.id.toString()); this.server.to(socket.id).emit('messages', messages); } diff --git a/back/volume/src/chat/chat.module.ts b/back/src/chat/chat.module.ts similarity index 100% rename from back/volume/src/chat/chat.module.ts rename to back/src/chat/chat.module.ts diff --git a/back/volume/src/chat/chat.service.ts b/back/src/chat/chat.service.ts similarity index 100% rename from back/volume/src/chat/chat.service.ts rename to back/src/chat/chat.service.ts diff --git a/back/volume/src/chat/dto/connection.dto.ts b/back/src/chat/dto/connection.dto.ts similarity index 100% rename from back/volume/src/chat/dto/connection.dto.ts rename to back/src/chat/dto/connection.dto.ts diff --git a/back/volume/src/chat/dto/create-channel.dto.ts b/back/src/chat/dto/create-channel.dto.ts similarity index 100% rename from back/volume/src/chat/dto/create-channel.dto.ts rename to back/src/chat/dto/create-channel.dto.ts diff --git a/back/volume/src/chat/dto/create-message.dto.ts b/back/src/chat/dto/create-message.dto.ts similarity index 100% rename from back/volume/src/chat/dto/create-message.dto.ts rename to back/src/chat/dto/create-message.dto.ts diff --git a/back/volume/src/chat/dto/kickUser.dto.ts b/back/src/chat/dto/kickUser.dto.ts similarity index 100% rename from back/volume/src/chat/dto/kickUser.dto.ts rename to back/src/chat/dto/kickUser.dto.ts diff --git a/back/volume/src/chat/dto/update-channel.dto.ts b/back/src/chat/dto/update-channel.dto.ts similarity index 100% rename from back/volume/src/chat/dto/update-channel.dto.ts rename to back/src/chat/dto/update-channel.dto.ts diff --git a/back/volume/src/chat/dto/updateUser.dto.ts b/back/src/chat/dto/updateUser.dto.ts similarity index 100% rename from back/volume/src/chat/dto/updateUser.dto.ts rename to back/src/chat/dto/updateUser.dto.ts diff --git a/back/volume/src/chat/entity/channel.entity.ts b/back/src/chat/entity/channel.entity.ts similarity index 100% rename from back/volume/src/chat/entity/channel.entity.ts rename to back/src/chat/entity/channel.entity.ts diff --git a/back/volume/src/chat/entity/connection.entity.ts b/back/src/chat/entity/connection.entity.ts similarity index 100% rename from back/volume/src/chat/entity/connection.entity.ts rename to back/src/chat/entity/connection.entity.ts diff --git a/back/volume/src/chat/entity/dm.entity.ts b/back/src/chat/entity/dm.entity.ts similarity index 100% rename from back/volume/src/chat/entity/dm.entity.ts rename to back/src/chat/entity/dm.entity.ts diff --git a/back/volume/src/chat/entity/message.entity.ts b/back/src/chat/entity/message.entity.ts similarity index 100% rename from back/volume/src/chat/entity/message.entity.ts rename to back/src/chat/entity/message.entity.ts diff --git a/back/volume/src/chat/message.service.ts b/back/src/chat/message.service.ts similarity index 100% rename from back/volume/src/chat/message.service.ts rename to back/src/chat/message.service.ts diff --git a/back/volume/src/main.ts b/back/src/main.ts similarity index 100% rename from back/volume/src/main.ts rename to back/src/main.ts diff --git a/back/volume/src/pong/dtos/GameCreationDtoValidated.ts b/back/src/pong/dtos/GameCreationDtoValidated.ts similarity index 100% rename from back/volume/src/pong/dtos/GameCreationDtoValidated.ts rename to back/src/pong/dtos/GameCreationDtoValidated.ts diff --git a/back/volume/src/pong/dtos/GameInfo.ts b/back/src/pong/dtos/GameInfo.ts similarity index 100% rename from back/volume/src/pong/dtos/GameInfo.ts rename to back/src/pong/dtos/GameInfo.ts diff --git a/back/volume/src/pong/dtos/GameUpdate.ts b/back/src/pong/dtos/GameUpdate.ts similarity index 100% rename from back/volume/src/pong/dtos/GameUpdate.ts rename to back/src/pong/dtos/GameUpdate.ts diff --git a/back/volume/src/pong/dtos/MapDtoValidated.ts b/back/src/pong/dtos/MapDtoValidated.ts similarity index 100% rename from back/volume/src/pong/dtos/MapDtoValidated.ts rename to back/src/pong/dtos/MapDtoValidated.ts diff --git a/back/volume/src/pong/dtos/MatchmakingDto.ts b/back/src/pong/dtos/MatchmakingDto.ts similarity index 100% rename from back/volume/src/pong/dtos/MatchmakingDto.ts rename to back/src/pong/dtos/MatchmakingDto.ts diff --git a/back/volume/src/pong/dtos/MatchmakingDtoValidated.ts b/back/src/pong/dtos/MatchmakingDtoValidated.ts similarity index 100% rename from back/volume/src/pong/dtos/MatchmakingDtoValidated.ts rename to back/src/pong/dtos/MatchmakingDtoValidated.ts diff --git a/back/volume/src/pong/dtos/PointDtoValidated.ts b/back/src/pong/dtos/PointDtoValidated.ts similarity index 100% rename from back/volume/src/pong/dtos/PointDtoValidated.ts rename to back/src/pong/dtos/PointDtoValidated.ts diff --git a/back/volume/src/pong/dtos/RectDtoValidated.ts b/back/src/pong/dtos/RectDtoValidated.ts similarity index 100% rename from back/volume/src/pong/dtos/RectDtoValidated.ts rename to back/src/pong/dtos/RectDtoValidated.ts diff --git a/back/volume/src/pong/dtos/StringDto.ts b/back/src/pong/dtos/StringDto.ts similarity index 100% rename from back/volume/src/pong/dtos/StringDto.ts rename to back/src/pong/dtos/StringDto.ts diff --git a/back/volume/src/pong/dtos/StringDtoValidated.ts b/back/src/pong/dtos/StringDtoValidated.ts similarity index 100% rename from back/volume/src/pong/dtos/StringDtoValidated.ts rename to back/src/pong/dtos/StringDtoValidated.ts diff --git a/back/volume/src/pong/dtos/UserDto.ts b/back/src/pong/dtos/UserDto.ts similarity index 100% rename from back/volume/src/pong/dtos/UserDto.ts rename to back/src/pong/dtos/UserDto.ts diff --git a/back/volume/src/pong/entity/result.entity.ts b/back/src/pong/entity/result.entity.ts similarity index 100% rename from back/volume/src/pong/entity/result.entity.ts rename to back/src/pong/entity/result.entity.ts diff --git a/back/volume/src/pong/game/Ball.ts b/back/src/pong/game/Ball.ts similarity index 100% rename from back/volume/src/pong/game/Ball.ts rename to back/src/pong/game/Ball.ts diff --git a/back/volume/src/pong/game/Game.ts b/back/src/pong/game/Game.ts similarity index 100% rename from back/volume/src/pong/game/Game.ts rename to back/src/pong/game/Game.ts diff --git a/back/volume/src/pong/game/Games.ts b/back/src/pong/game/Games.ts similarity index 100% rename from back/volume/src/pong/game/Games.ts rename to back/src/pong/game/Games.ts diff --git a/back/volume/src/pong/game/MatchmakingQueue.ts b/back/src/pong/game/MatchmakingQueue.ts similarity index 100% rename from back/volume/src/pong/game/MatchmakingQueue.ts rename to back/src/pong/game/MatchmakingQueue.ts diff --git a/back/volume/src/pong/game/Paddle.ts b/back/src/pong/game/Paddle.ts similarity index 100% rename from back/volume/src/pong/game/Paddle.ts rename to back/src/pong/game/Paddle.ts diff --git a/back/volume/src/pong/game/Player.ts b/back/src/pong/game/Player.ts similarity index 100% rename from back/volume/src/pong/game/Player.ts rename to back/src/pong/game/Player.ts diff --git a/back/volume/src/pong/game/constants.ts b/back/src/pong/game/constants.ts similarity index 100% rename from back/volume/src/pong/game/constants.ts rename to back/src/pong/game/constants.ts diff --git a/back/volume/src/pong/game/utils.ts b/back/src/pong/game/utils.ts similarity index 100% rename from back/volume/src/pong/game/utils.ts rename to back/src/pong/game/utils.ts diff --git a/back/volume/src/pong/pong.controller.ts b/back/src/pong/pong.controller.ts similarity index 100% rename from back/volume/src/pong/pong.controller.ts rename to back/src/pong/pong.controller.ts diff --git a/back/volume/src/pong/pong.gateway.ts b/back/src/pong/pong.gateway.ts similarity index 100% rename from back/volume/src/pong/pong.gateway.ts rename to back/src/pong/pong.gateway.ts diff --git a/back/volume/src/pong/pong.module.ts b/back/src/pong/pong.module.ts similarity index 100% rename from back/volume/src/pong/pong.module.ts rename to back/src/pong/pong.module.ts diff --git a/back/volume/src/pong/pong.service.ts b/back/src/pong/pong.service.ts similarity index 100% rename from back/volume/src/pong/pong.service.ts rename to back/src/pong/pong.service.ts diff --git a/back/volume/src/types.d.ts b/back/src/types.d.ts similarity index 100% rename from back/volume/src/types.d.ts rename to back/src/types.d.ts diff --git a/back/volume/src/users/dto/user.dto.ts b/back/src/users/dto/user.dto.ts similarity index 100% rename from back/volume/src/users/dto/user.dto.ts rename to back/src/users/dto/user.dto.ts diff --git a/back/volume/src/users/entity/user.entity.ts b/back/src/users/entity/user.entity.ts similarity index 100% rename from back/volume/src/users/entity/user.entity.ts rename to back/src/users/entity/user.entity.ts diff --git a/back/volume/src/users/users.controller.ts b/back/src/users/users.controller.ts similarity index 100% rename from back/volume/src/users/users.controller.ts rename to back/src/users/users.controller.ts diff --git a/back/volume/src/users/users.module.ts b/back/src/users/users.module.ts similarity index 100% rename from back/volume/src/users/users.module.ts rename to back/src/users/users.module.ts diff --git a/back/volume/src/users/users.service.ts b/back/src/users/users.service.ts similarity index 100% rename from back/volume/src/users/users.service.ts rename to back/src/users/users.service.ts diff --git a/back/volume/tsconfig.build.json b/back/tsconfig.build.json similarity index 100% rename from back/volume/tsconfig.build.json rename to back/tsconfig.build.json diff --git a/back/volume/tsconfig.json b/back/tsconfig.json similarity index 100% rename from back/volume/tsconfig.json rename to back/tsconfig.json diff --git a/back/volume/README.md b/back/volume/README.md deleted file mode 100644 index 00a13b1..0000000 --- a/back/volume/README.md +++ /dev/null @@ -1,73 +0,0 @@ -

- Nest Logo -

- -[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 -[circleci-url]: https://circleci.com/gh/nestjs/nest - -

A progressive Node.js framework for building efficient and scalable server-side applications.

-

-NPM Version -Package License -NPM Downloads -CircleCI -Coverage -Discord -Backers on Open Collective -Sponsors on Open Collective - - Support us - -

- - -## Description - -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. - -## Installation - -```bash -$ npm install -``` - -## Running the app - -```bash -# development -$ npm run start - -# watch mode -$ npm run start:dev - -# production mode -$ npm run start:prod -``` - -## Test - -```bash -# unit tests -$ npm run test - -# e2e tests -$ npm run test:e2e - -# test coverage -$ npm run test:cov -``` - -## Support - -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). - -## Stay in touch - -- Author - [Kamil Myƛliwiec](https://kamilmysliwiec.com) -- Website - [https://nestjs.com](https://nestjs.com/) -- Twitter - [@nestframework](https://twitter.com/nestframework) - -## License - -Nest is [MIT licensed](LICENSE). diff --git a/back/volume/src/app.module.ts b/back/volume/src/app.module.ts deleted file mode 100644 index 2e363df..0000000 --- a/back/volume/src/app.module.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Module } from '@nestjs/common' -import { ConfigModule, ConfigService } from '@nestjs/config' -import { TypeOrmModule } from '@nestjs/typeorm' -import * as Joi from 'joi' -import { ScheduleModule } from '@nestjs/schedule' - -import { AuthModule } from './auth/auth.module' -import { ChatModule } from './chat/chat.module' -import { PongModule } from './pong/pong.module' -import { UsersModule } from './users/users.module' - -@Module({ - imports: [ - ScheduleModule.forRoot(), - ConfigModule.forRoot({ - validationSchema: Joi.object({ - POSTGRES_HOST: Joi.string().required(), - POSTGRES_PORT: Joi.number().required(), - POSTGRES_USER: Joi.string().required(), - POSTGRES_PASSWORD: Joi.string().required(), - POSTGRES_DB: Joi.string().required(), - MAIL_USER: Joi.string().required(), - MAIL_PASSWORD: Joi.string().required(), - JWT_SECRET: Joi.string().required(), - JWT_EXPIRATION_TIME: Joi.string().required(), - HOST: Joi.string().required(), - FRONT_PORT: Joi.number().required(), - BACK_PORT: Joi.number().required(), - HASH_SALT: Joi.number().required() - }) - }), - TypeOrmModule.forRootAsync({ - imports: [ConfigModule], - inject: [ConfigService], - useFactory: (configService: ConfigService) => ({ - type: 'postgres', - host: configService.get('POSTGRES_HOST'), - port: configService.get('POSTGRES_PORT'), - username: configService.get('POSTGRES_USER'), - password: configService.get('POSTGRES_PASSWORD'), - database: configService.get('POSTGRES_DB'), - jwt_secret: configService.get('JWT_SECRET'), - autoLoadEntities: true, - synchronize: true - }) - }), - AuthModule, - ChatModule, - PongModule, - UsersModule - ] -}) -export class AppModule {} diff --git a/docker-compose.yml b/docker-compose.yml index 501063f..1570343 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,25 +6,29 @@ networks: services: front: container_name: front - build: front/ + build: + context: ./ + dockerfile: front.dockerfile env_file: .env environment: - NODE_ENV=${NODE_ENV} depends_on: [postgres, back] ports: [80:80] - volumes: [./front/volume:/var/www/html] + volumes: [./front:/var/www/html] networks: [transcendence] restart: on-failure back: container_name: back - build: back/ + build: + context: ./ + dockerfile: back.dockerfile env_file: .env environment: - NODE_ENV=${NODE_ENV} depends_on: [postgres] ports: [3001:3001] networks: [transcendence] - volumes: [./back/volume:/var/www/html] + volumes: [./back:/var/www/html] restart: on-failure postgres: container_name: postgres diff --git a/front/Dockerfile b/front.dockerfile similarity index 51% rename from front/Dockerfile rename to front.dockerfile index a337fe7..507ddea 100644 --- a/front/Dockerfile +++ b/front.dockerfile @@ -1,8 +1,5 @@ FROM alpine:3.15 RUN apk update && apk upgrade && apk add npm - WORKDIR /var/www/html -COPY entrypoint.sh /tmp/entrypoint.sh - -ENTRYPOINT ["sh", "/tmp/entrypoint.sh"] +ENTRYPOINT npm install && npm run dev diff --git a/front/volume/.gitignore b/front/.gitignore similarity index 100% rename from front/volume/.gitignore rename to front/.gitignore diff --git a/front/entrypoint.sh b/front/entrypoint.sh deleted file mode 100644 index 3694170..0000000 --- a/front/entrypoint.sh +++ /dev/null @@ -1,13 +0,0 @@ -npm install; -cat >.env < import { content, show_popup } from './Alert/content' + import { onMount } from "svelte"; + import { API_URL, store } from "../Auth"; + import type User from "./Profile.svelte"; + import { APPSTATE } from "../App.svelte"; + + export let appState: string; + export let setAppState: (newState: APPSTATE | string) => void; export interface ChannelsType { id: number; @@ -16,9 +23,6 @@ author: User; text: string; } - import { onMount } from "svelte"; - import { API_URL, store } from "../Auth"; - import type User from "./Profile.svelte"; export async function formatChannelNames(channel: Array): Promise { const res = await fetch(API_URL + "/users/all", { @@ -60,6 +64,7 @@ } } } +