├── README.md ├── docker-compose.yml └── src ├── backend ├── .dockerignore ├── .env.template ├── .gitignore ├── Dockerfile ├── README.md ├── dist │ ├── app.module.d.ts │ ├── app.module.js │ ├── app.module.js.map │ ├── auth │ │ ├── auth-exception.filter.d.ts │ │ ├── auth-exception.filter.js │ │ ├── auth-exception.filter.js.map │ │ ├── auth.controller.d.ts │ │ ├── auth.controller.js │ │ ├── auth.controller.js.map │ │ ├── auth.module.d.ts │ │ ├── auth.module.js │ │ ├── auth.module.js.map │ │ ├── auth.service.d.ts │ │ ├── auth.service.js │ │ ├── auth.service.js.map │ │ ├── jwt-payload.interface.d.ts │ │ ├── jwt-payload.interface.js │ │ ├── jwt-payload.interface.js.map │ │ ├── jwt.strategy.d.ts │ │ ├── jwt.strategy.js │ │ └── jwt.strategy.js.map │ ├── chat │ │ ├── chat.controller.d.ts │ │ ├── chat.controller.js │ │ ├── chat.controller.js.map │ │ ├── chat.gateway.d.ts │ │ ├── chat.gateway.js │ │ ├── chat.gateway.js.map │ │ ├── chat.module.d.ts │ │ ├── chat.module.js │ │ ├── chat.module.js.map │ │ ├── chat.service.d.ts │ │ ├── chat.service.js │ │ ├── chat.service.js.map │ │ ├── dto │ │ │ ├── join-channel-dto.d.ts │ │ │ ├── join-channel-dto.js │ │ │ ├── join-channel-dto.js.map │ │ │ ├── member-dto.d.ts │ │ │ ├── member-dto.js │ │ │ ├── member-dto.js.map │ │ │ ├── membership-dto.d.ts │ │ │ ├── membership-dto.js │ │ │ ├── membership-dto.js.map │ │ │ ├── membership.model.d.ts │ │ │ ├── membership.model.js │ │ │ ├── membership.model.js.map │ │ │ ├── message-dto.d.ts │ │ │ ├── message-dto.js │ │ │ ├── message-dto.js.map │ │ │ ├── mute-dto.d.ts │ │ │ ├── mute-dto.js │ │ │ ├── mute-dto.js.map │ │ │ ├── room-dto.d.ts │ │ │ ├── room-dto.js │ │ │ └── room-dto.js.map │ │ ├── membership.entity.d.ts │ │ ├── membership.entity.js │ │ ├── membership.entity.js.map │ │ ├── message.entity.d.ts │ │ ├── message.entity.js │ │ ├── message.entity.js.map │ │ ├── room.entity.d.ts │ │ ├── room.entity.js │ │ ├── room.entity.js.map │ │ ├── room.repository.d.ts │ │ ├── room.repository.js │ │ └── room.repository.js.map │ ├── config │ │ ├── logger.middleware.d.ts │ │ ├── logger.middleware.js │ │ ├── logger.middleware.js.map │ │ ├── typeorm.config.d.ts │ │ ├── typeorm.config.js │ │ └── typeorm.config.js.map │ ├── main.d.ts │ ├── main.js │ ├── main.js.map │ ├── players │ │ ├── app.gateway.d.ts │ │ ├── app.gateway.js │ │ ├── app.gateway.js.map │ │ ├── dto-players │ │ │ ├── create-player.dto.d.ts │ │ │ ├── create-player.dto.js │ │ │ ├── create-player.dto.js.map │ │ │ ├── get-player-filter.dto.d.ts │ │ │ ├── get-player-filter.dto.js │ │ │ └── get-player-filter.dto.js.map │ │ ├── player.entity.d.ts │ │ ├── player.entity.js │ │ ├── player.entity.js.map │ │ ├── player.repository.d.ts │ │ ├── player.repository.js │ │ ├── player.repository.js.map │ │ ├── player_status.enum.d.ts │ │ ├── player_status.enum.js │ │ ├── player_status.enum.js.map │ │ ├── players.controller.d.ts │ │ ├── players.controller.js │ │ ├── players.controller.js.map │ │ ├── players.module.d.ts │ │ ├── players.module.js │ │ ├── players.module.js.map │ │ ├── players.service.d.ts │ │ ├── players.service.js │ │ └── players.service.js.map │ ├── pong-game │ │ ├── default.gateway.d.ts │ │ ├── default.gateway.js │ │ ├── default.gateway.js.map │ │ ├── default.service.d.ts │ │ ├── default.service.js │ │ ├── default.service.js.map │ │ ├── difficult.gateway.d.ts │ │ ├── difficult.gateway.js │ │ ├── difficult.gateway.js.map │ │ ├── difficult.service.d.ts │ │ ├── difficult.service.js │ │ ├── difficult.service.js.map │ │ ├── dto │ │ │ ├── createGameHistory.dto.d.ts │ │ │ ├── createGameHistory.dto.js │ │ │ ├── createGameHistory.dto.js.map │ │ │ ├── createGameRoom.dto.d.ts │ │ │ ├── createGameRoom.dto.js │ │ │ └── createGameRoom.dto.js.map │ │ ├── interfaces │ │ │ ├── Ball.d.ts │ │ │ ├── Ball.js │ │ │ ├── Ball.js.map │ │ │ ├── Paddle.d.ts │ │ │ ├── Paddle.js │ │ │ ├── Paddle.js.map │ │ │ ├── Player.d.ts │ │ │ ├── Player.js │ │ │ ├── Player.js.map │ │ │ ├── Playground.d.ts │ │ │ ├── Playground.js │ │ │ ├── Playground.js.map │ │ │ ├── ScoreBoard.d.ts │ │ │ ├── ScoreBoard.js │ │ │ ├── ScoreBoard.js.map │ │ │ ├── game_mood.enum.d.ts │ │ │ ├── game_mood.enum.js │ │ │ ├── game_mood.enum.js.map │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ └── index.js.map │ │ ├── one-v-one.gateway.d.ts │ │ ├── one-v-one.gateway.js │ │ ├── one-v-one.gateway.js.map │ │ ├── one-v-one.service.d.ts │ │ ├── one-v-one.service.js │ │ ├── one-v-one.service.js.map │ │ ├── pong-game.controller.d.ts │ │ ├── pong-game.controller.js │ │ ├── pong-game.controller.js.map │ │ ├── pong-game.module.d.ts │ │ ├── pong-game.module.js │ │ ├── pong-game.module.js.map │ │ ├── pong-game.service.d.ts │ │ ├── pong-game.service.js │ │ ├── pong-game.service.js.map │ │ ├── typeorm │ │ │ ├── game-history.entity.d.ts │ │ │ ├── game-history.entity.js │ │ │ ├── game-history.entity.js.map │ │ │ ├── game-room.entity.d.ts │ │ │ ├── game-room.entity.js │ │ │ └── game-room.entity.js.map │ │ └── utils │ │ │ ├── Ball.d.ts │ │ │ ├── Ball.js │ │ │ ├── Ball.js.map │ │ │ ├── Bounds.d.ts │ │ │ ├── Bounds.js │ │ │ ├── Bounds.js.map │ │ │ ├── Paddle.d.ts │ │ │ ├── Paddle.js │ │ │ ├── Paddle.js.map │ │ │ ├── PaddleController.d.ts │ │ │ ├── PaddleController.js │ │ │ ├── PaddleController.js.map │ │ │ ├── PlayGround.d.ts │ │ │ ├── PlayGround.js │ │ │ ├── PlayGround.js.map │ │ │ ├── Player.d.ts │ │ │ ├── Player.js │ │ │ ├── Player.js.map │ │ │ ├── ScoreBoard.d.ts │ │ │ ├── ScoreBoard.js │ │ │ ├── ScoreBoard.js.map │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ └── index.js.map │ ├── relations │ │ ├── dto-relation │ │ │ ├── create-relation.dto.d.ts │ │ │ ├── create-relation.dto.js │ │ │ ├── create-relation.dto.js.map │ │ │ ├── get-relation-filter.dto.d.ts │ │ │ ├── get-relation-filter.dto.js │ │ │ └── get-relation-filter.dto.js.map │ │ ├── relation.entity.d.ts │ │ ├── relation.entity.js │ │ ├── relation.entity.js.map │ │ ├── relation.repository.d.ts │ │ ├── relation.repository.js │ │ ├── relation.repository.js.map │ │ ├── relation_status.enum.d.ts │ │ ├── relation_status.enum.js │ │ ├── relation_status.enum.js.map │ │ ├── relations.controller.d.ts │ │ ├── relations.controller.js │ │ ├── relations.controller.js.map │ │ ├── relations.module.d.ts │ │ ├── relations.module.js │ │ ├── relations.module.js.map │ │ ├── relations.service.d.ts │ │ ├── relations.service.js │ │ └── relations.service.js.map │ └── tsconfig.build.tsbuildinfo ├── nest-cli.json ├── npmList_packages ├── package-lock.json ├── package.json ├── package_installed.txt ├── public │ ├── aait-hmi.jpg │ ├── aait-hmi.png │ ├── mlachheb.jpeg │ ├── mlachheb.png │ ├── oumeimatt.jpeg │ └── qr_62530.png ├── src │ ├── app.module.ts │ ├── auth │ │ ├── auth-exception.filter.ts │ │ ├── auth.controller.ts │ │ ├── auth.module.ts │ │ ├── auth.service.ts │ │ ├── jwt-payload.interface.ts │ │ └── jwt.strategy.ts │ ├── chat │ │ ├── chat.controller.ts │ │ ├── chat.gateway.ts │ │ ├── chat.module.ts │ │ ├── chat.service.spec.ts │ │ ├── chat.service.ts │ │ ├── dto │ │ │ ├── join-channel-dto.ts │ │ │ ├── member-dto.ts │ │ │ ├── membership-dto.ts │ │ │ ├── membership.model.ts │ │ │ ├── message-dto.ts │ │ │ ├── mute-dto.ts │ │ │ └── room-dto.ts │ │ ├── membership.entity.ts │ │ ├── message.entity.ts │ │ ├── room.entity.ts │ │ └── room.repository.ts │ ├── config │ │ ├── logger.middleware.ts │ │ └── typeorm.config.ts │ ├── main.ts │ ├── players │ │ ├── app.gateway.ts │ │ ├── dto-players │ │ │ ├── create-player.dto.ts │ │ │ └── get-player-filter.dto.ts │ │ ├── player.entity.ts │ │ ├── player.repository.ts │ │ ├── player_status.enum.ts │ │ ├── players.controller.ts │ │ ├── players.module.ts │ │ └── players.service.ts │ ├── pong-game │ │ ├── default.gateway.ts │ │ ├── default.service.ts │ │ ├── difficult.gateway.ts │ │ ├── difficult.service.ts │ │ ├── dto │ │ │ ├── createGameHistory.dto.ts │ │ │ └── createGameRoom.dto.ts │ │ ├── interfaces │ │ │ ├── Ball.ts │ │ │ ├── Paddle.ts │ │ │ ├── Player.ts │ │ │ ├── Playground.ts │ │ │ ├── ScoreBoard.ts │ │ │ ├── game_mood.enum.ts │ │ │ └── index.ts │ │ ├── one-v-one.gateway.ts │ │ ├── one-v-one.service.ts │ │ ├── pong-game.controller.ts │ │ ├── pong-game.module.ts │ │ ├── pong-game.service.ts │ │ ├── typeorm │ │ │ ├── game-history.entity.ts │ │ │ └── game-room.entity.ts │ │ └── utils │ │ │ ├── Ball.ts │ │ │ ├── Bounds.ts │ │ │ ├── Paddle.ts │ │ │ ├── PaddleController.ts │ │ │ ├── PlayGround.ts │ │ │ ├── Player.ts │ │ │ ├── ScoreBoard.ts │ │ │ └── index.ts │ └── relations │ │ ├── dto-relation │ │ ├── create-relation.dto.ts │ │ └── get-relation-filter.dto.ts │ │ ├── relation.entity.ts │ │ ├── relation.repository.ts │ │ ├── relation_status.enum.ts │ │ ├── relations.controller.ts │ │ ├── relations.module.ts │ │ └── relations.service.ts ├── test.html ├── test │ ├── app.e2e-spec.ts │ └── jest-e2e.json ├── tsconfig.build.json └── tsconfig.json └── frontend ├── .dockerignore ├── .gitignore ├── Dockerfile ├── README.md ├── dist ├── assets │ ├── Public.8c1f450f.png │ ├── aes-salm.jpeg │ ├── bg1.c8de8364.jpg │ ├── cover.a74cbda5.png │ ├── dsdsd.jpeg │ ├── edit.5d557bad.png │ ├── framdani.61c90572.jpeg │ ├── ggggh.png │ ├── ibouhiri.svg │ ├── ii.svg │ ├── iidzim.f32b5eda.jpeg │ ├── iidzim.svg │ ├── ikram.png │ ├── ikram.svg │ ├── ikrax.png │ ├── index.4121193c.css │ ├── index.ed8c8ed7.js │ ├── medal.d1a76526.png │ ├── mlachheb.1184646b.jpeg │ ├── mlachheb.jpeg │ ├── mlachheb.png │ ├── oel-yous.88d41c8d.jpeg │ ├── oel-yous.jpeg │ ├── oel-yous.png │ ├── oel-yous.svg │ ├── oumeimatt.svg │ ├── oumixa.jpeg │ ├── pineeb.svg │ ├── pong.d58877dc.png │ ├── seven.svg │ ├── silver.e44dc2c8.png │ └── yhadari.svg ├── favicon.ico └── index.html ├── index.html ├── nginx.conf ├── package-lock.json ├── package.json ├── postcss.config.js ├── public ├── assets │ ├── aes-salm.jpeg │ ├── dsdsd.jpeg │ ├── ggggh.png │ ├── ibouhiri.svg │ ├── ii.svg │ ├── iidzim.svg │ ├── ikram.png │ ├── ikram.svg │ ├── ikrax.png │ ├── mlachheb.jpeg │ ├── mlachheb.png │ ├── oel-yous.jpeg │ ├── oel-yous.png │ ├── oel-yous.svg │ ├── oumeimatt.svg │ ├── oumixa.jpeg │ ├── pineeb.svg │ ├── seven.svg │ └── yhadari.svg └── favicon.ico ├── src ├── .gitignore ├── App.vue ├── Styles │ └── container.sass ├── assets │ ├── Public.png │ ├── bg.jpg │ ├── bg1.jpg │ ├── bronze.png │ ├── cover.png │ ├── edit.png │ ├── framdani.jpeg │ ├── github.png │ ├── gold.png │ ├── group.png │ ├── iidzim.jpeg │ ├── medal.png │ ├── mlachheb.jpeg │ ├── oel-yous.jpeg │ ├── pong.png │ └── silver.png ├── components │ ├── Footer.vue │ ├── Header.vue │ ├── LoadingBar.vue │ ├── chatnavbar.vue │ ├── conversation.vue │ ├── conversationRoom.vue │ └── membersBar.vue ├── index.css ├── interfaces │ ├── Ball.ts │ ├── Bounds.ts │ ├── GameRoom.ts │ ├── Paddle.ts │ ├── Player.ts │ ├── PlayerProfile.ts │ ├── Playground.ts │ ├── ScoreBoard.ts │ ├── UserInfos.ts │ ├── chatRoom.ts │ └── index.ts ├── main.ts ├── router │ └── index.ts ├── store │ └── index.ts ├── utils │ └── Draw.ts └── views │ ├── Chat.vue │ ├── ChatRoom.vue │ ├── EmptyChat.vue │ ├── Game.vue │ ├── Home.vue │ ├── OneVOne.vue │ ├── Play.vue │ ├── Profile.vue │ ├── Signin.vue │ ├── Stream.vue │ ├── User.vue │ ├── WatchGames.vue │ └── twofactorauthentication.vue ├── tailwind.config.js └── vite.config.js /README.md: -------------------------------------------------------------------------------- 1 | # Trandandan 2 | This is a multiplayer pong website created using VueJS, NestJS and PostgreSQL. 3 | 4 | ## Use case diagram 5 | 6 | The diagram below represents all the services provided by this website. A Logged in user is able to: 7 | - Invite and play a live Pong game versus other players. 8 | - Chat with friends through joined channels or send direct message instantly to friends. 9 | 10 | 11 |

12 | Screen Shot 2022-08-03 at 7 50 42 PM 13 |

14 | 15 | ## Database schema 16 |

17 | Screen Shot 2022-08-03 at 16 54 09 18 |

19 | 20 | 21 | ## Some screenshots 22 | 23 |

24 | Home 25 | 26 | Chat 27 | 28 | Game 29 |

30 | 31 | ## Authors 32 | - [framdani](https://github.com/framdani) was responsible for the real time chat. 33 | - The Frontend was made by [oumeimatt](https://github.com/oumeimatt). 34 | - User account and authentication by [iidzim](https://github.com/iidzim). 35 | - The game was created by [mlachheb](https://github.com/mohamedamine456). 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2.2' 2 | 3 | services: 4 | database: 5 | image: postgres 6 | environment: 7 | - POSTGRES_USER=ping 8 | - POSTGRES_PASSWORD=pong 9 | - POSTGRES_DB=pong_db 10 | ports: 11 | - 5432:5432 12 | volumes: 13 | - database:/var/lib/postgresql/data 14 | backend: 15 | build: 16 | context: ./src/backend 17 | dockerfile: 'Dockerfile' 18 | ports: 19 | - '3001:3001' 20 | frontend: 21 | build: 22 | context: ./src/frontend 23 | dockerfile: 'Dockerfile' 24 | ports: 25 | - 80:80 26 | 27 | 28 | volumes: 29 | database: {} -------------------------------------------------------------------------------- /src/backend/.dockerignore: -------------------------------------------------------------------------------- 1 | **/node_modules/ 2 | **/dist 3 | -------------------------------------------------------------------------------- /src/backend/.env.template: -------------------------------------------------------------------------------- 1 | APP_NAME= 2 | FRONTEND_HOST= 3 | BACKEND_HOST= 4 | 5 | # database 6 | 7 | POSTGRES_DB_NAME= 8 | POSTGRES_USER= 9 | POSTGRES_PASSWORD= 10 | 11 | # intranet 42 12 | UID= 13 | SECRET= 14 | CALLBACK_URL= 15 | -------------------------------------------------------------------------------- /src/backend/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env -------------------------------------------------------------------------------- /src/backend/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:14-alpine AS builder 2 | WORKDIR "/app" 3 | COPY . . 4 | RUN npm ci 5 | RUN npm run build 6 | FROM node:14-alpine AS production 7 | WORKDIR "/app" 8 | COPY --from=builder /app/package.json ./package.json 9 | COPY --from=builder /app/package-lock.json ./package-lock.json 10 | COPY --from=builder /app/public ./public 11 | COPY --from=builder /app/dist ./dist 12 | COPY --from=builder /app/node_modules ./node_modules 13 | COPY --from=builder /app/.env ./.env 14 | CMD [ "sh", "-c", "npm run start:prod"] 15 | -------------------------------------------------------------------------------- /src/backend/dist/app.module.d.ts: -------------------------------------------------------------------------------- 1 | export declare class AppModule { 2 | } 3 | -------------------------------------------------------------------------------- /src/backend/dist/app.module.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | Object.defineProperty(exports, "__esModule", { value: true }); 9 | exports.AppModule = void 0; 10 | const common_1 = require("@nestjs/common"); 11 | const config_1 = require("@nestjs/config"); 12 | const typeorm_1 = require("@nestjs/typeorm"); 13 | const typeorm_config_1 = require("./config/typeorm.config"); 14 | const auth_module_1 = require("./auth/auth.module"); 15 | const players_module_1 = require("./players/players.module"); 16 | const relations_module_1 = require("./relations/relations.module"); 17 | const pong_game_module_1 = require("./pong-game/pong-game.module"); 18 | const chat_module_1 = require("./chat/chat.module"); 19 | const serve_static_1 = require("@nestjs/serve-static"); 20 | const path_1 = require("path"); 21 | let AppModule = class AppModule { 22 | }; 23 | AppModule = __decorate([ 24 | (0, common_1.Module)({ 25 | imports: [ 26 | serve_static_1.ServeStaticModule.forRoot({ 27 | rootPath: (0, path_1.join)(__dirname, '..', 'public'), 28 | }), 29 | config_1.ConfigModule.forRoot({ envFilePath: '.env' }), 30 | typeorm_1.TypeOrmModule.forRoot(typeorm_config_1.typeOrmConfig), 31 | auth_module_1.AuthModule, 32 | players_module_1.PlayerModule, 33 | relations_module_1.RelationModule, 34 | pong_game_module_1.PongGameModule, 35 | chat_module_1.ChatModule, 36 | ], 37 | controllers: [], 38 | providers: [], 39 | }) 40 | ], AppModule); 41 | exports.AppModule = AppModule; 42 | //# sourceMappingURL=app.module.js.map -------------------------------------------------------------------------------- /src/backend/dist/app.module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwE;AACxE,2CAA8C;AAC9C,6CAAgD;AAChD,4DAAwD;AACxD,oDAAgD;AAChD,6DAAwD;AACxD,mEAA8D;AAC9D,mEAA8D;AAC9D,oDAAgD;AAChD,uDAAyD;AACzD,+BAA4B;AAoB5B,IAAa,SAAS,GAAtB,MAAa,SAAS;CAAG,CAAA;AAAZ,SAAS;IAhBrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,gCAAiB,CAAC,OAAO,CAAC;gBACxB,QAAQ,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC;aAC1C,CAAC;YACF,qBAAY,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;YAC7C,uBAAa,CAAC,OAAO,CAAC,8BAAa,CAAC;YACpC,wBAAU;YACV,6BAAY;YACZ,iCAAc;YACd,iCAAc;YACd,wBAAU;SACX;QACD,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,EAAE;KACd,CAAC;GACW,SAAS,CAAG;AAAZ,8BAAS"} -------------------------------------------------------------------------------- /src/backend/dist/auth/auth-exception.filter.d.ts: -------------------------------------------------------------------------------- 1 | import { ArgumentsHost, ExceptionFilter } from "@nestjs/common"; 2 | export declare class AuthExceptionFilter implements ExceptionFilter { 3 | catch(exception: any, host: ArgumentsHost): void; 4 | } 5 | -------------------------------------------------------------------------------- /src/backend/dist/auth/auth-exception.filter.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | Object.defineProperty(exports, "__esModule", { value: true }); 9 | exports.AuthExceptionFilter = void 0; 10 | const common_1 = require("@nestjs/common"); 11 | let AuthExceptionFilter = class AuthExceptionFilter { 12 | catch(exception, host) { 13 | const ctx = host.switchToHttp(); 14 | const response = ctx.getResponse(); 15 | const request = ctx.getRequest(); 16 | const status = exception.getStatus(); 17 | const message = exception.message; 18 | if (status === 401) 19 | response.redirect('http://' + process.env.FRONTEND_HOST + '/home'); 20 | else { 21 | response.status(status).json({ 22 | statusCode: status, 23 | message: message, 24 | timestamp: new Date().toISOString(), 25 | path: request.url, 26 | }); 27 | } 28 | } 29 | }; 30 | AuthExceptionFilter = __decorate([ 31 | (0, common_1.Catch)(common_1.HttpException) 32 | ], AuthExceptionFilter); 33 | exports.AuthExceptionFilter = AuthExceptionFilter; 34 | //# sourceMappingURL=auth-exception.filter.js.map -------------------------------------------------------------------------------- /src/backend/dist/auth/auth-exception.filter.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"auth-exception.filter.js","sourceRoot":"","sources":["../../src/auth/auth-exception.filter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAsF;AAItF,IAAa,mBAAmB,GAAhC,MAAa,mBAAmB;IAE5B,KAAK,CAAC,SAAc,EAAE,IAAmB;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAC7C,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QAC1C,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;QAClC,IAAI,MAAM,KAAK,GAAG;YACd,QAAQ,CAAC,QAAQ,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,GAAE,OAAO,CAAC,CAAC;aACjE;YACD,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;gBACzB,UAAU,EAAE,MAAM;gBAClB,OAAO,EAAE,OAAO;gBAChB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,IAAI,EAAE,OAAO,CAAC,GAAG;aACpB,CAAC,CAAC;SACN;IACL,CAAC;CACJ,CAAA;AAnBY,mBAAmB;IAD/B,IAAA,cAAK,EAAC,sBAAa,CAAC;GACR,mBAAmB,CAmB/B;AAnBY,kDAAmB"} -------------------------------------------------------------------------------- /src/backend/dist/auth/auth.controller.d.ts: -------------------------------------------------------------------------------- 1 | import { AuthService } from './auth.service'; 2 | import { Request } from "express"; 3 | import { UsersService } from '../players/players.service'; 4 | export declare class AuthController { 5 | private readonly authService; 6 | private readonly usersService; 7 | constructor(authService: AuthService, usersService: UsersService); 8 | FortyTwoAuth(req: Request, res: any): Promise; 9 | logout(req: Request, res: Response): Promise; 10 | } 11 | -------------------------------------------------------------------------------- /src/backend/dist/auth/auth.controller.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA6G;AAC7G,iDAA6C;AAE7C,+CAA6C;AAC7C,gEAA0D;AAC1D,mEAA8D;AAG9D,IAAa,cAAc,GAA3B,MAAa,cAAc;IAC1B,YACkB,WAAwB,EACxB,YAA0B;QAD1B,gBAAW,GAAX,WAAW,CAAa;QACxB,iBAAY,GAAZ,YAAY,CAAc;IACzC,CAAC;IAKJ,KAAK,CAAC,YAAY,CACV,GAAY,EACP,GAAG;QAEf,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;IAGE,KAAK,CAAC,MAAM,CACD,GAAY,EACZ,GAAa;QAGpB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IACjD,CAAC;CAEJ,CAAA;AAjBA;IAHC,IAAA,YAAG,EAAC,QAAQ,CAAC;IACb,IAAA,mBAAU,EAAC,IAAI,2CAAmB,EAAE,CAAC;IACrC,IAAA,kBAAS,EAAC,IAAA,oBAAS,EAAC,IAAI,CAAC,CAAC;IAEzB,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,iBAAQ,GAAE,CAAA;;;;kDAGX;AAGE;IADF,IAAA,YAAG,EAAC,SAAS,CAAC;IAEP,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,YAAG,GAAE,CAAA;;;;4CAKT;AAxBQ,cAAc;IAD1B,IAAA,mBAAU,EAAC,OAAO,CAAC;qCAGY,0BAAW;QACV,8BAAY;GAHhC,cAAc,CA0B1B;AA1BY,wCAAc"} -------------------------------------------------------------------------------- /src/backend/dist/auth/auth.module.d.ts: -------------------------------------------------------------------------------- 1 | export declare class AuthModule { 2 | } 3 | -------------------------------------------------------------------------------- /src/backend/dist/auth/auth.module.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | Object.defineProperty(exports, "__esModule", { value: true }); 9 | exports.AuthModule = void 0; 10 | const common_1 = require("@nestjs/common"); 11 | const jwt_1 = require("@nestjs/jwt"); 12 | const passport_1 = require("@nestjs/passport"); 13 | const typeorm_1 = require("@nestjs/typeorm"); 14 | const player_repository_1 = require("../players/player.repository"); 15 | const players_module_1 = require("../players/players.module"); 16 | const players_service_1 = require("../players/players.service"); 17 | const auth_controller_1 = require("./auth.controller"); 18 | const auth_service_1 = require("./auth.service"); 19 | let AuthModule = class AuthModule { 20 | }; 21 | AuthModule = __decorate([ 22 | (0, common_1.Module)({ 23 | imports: [ 24 | passport_1.PassportModule.register({ defaultStrategy: 'jwt' }), 25 | jwt_1.JwtModule.register({ 26 | secret: 'pingpong', 27 | signOptions: { 28 | expiresIn: '1d', 29 | }, 30 | }), 31 | typeorm_1.TypeOrmModule.forFeature([player_repository_1.PlayerRepository]), 32 | players_module_1.PlayerModule, 33 | ], 34 | controllers: [auth_controller_1.AuthController], 35 | providers: [ 36 | auth_service_1.AuthService, 37 | players_service_1.UsersService, 38 | ], 39 | exports: [auth_service_1.AuthService, players_service_1.UsersService] 40 | }) 41 | ], AuthModule); 42 | exports.AuthModule = AuthModule; 43 | //# sourceMappingURL=auth.module.js.map -------------------------------------------------------------------------------- /src/backend/dist/auth/auth.module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qCAAwC;AACxC,+CAAkD;AAClD,6CAAgD;AAChD,oEAAgE;AAChE,8DAAyD;AACzD,gEAA0D;AAC1D,uDAAmD;AACnD,iDAA6C;AAqB7C,IAAa,UAAU,GAAvB,MAAa,UAAU;CAAG,CAAA;AAAb,UAAU;IAnBtB,IAAA,eAAM,EAAC;QACP,OAAO,EAAE;YACR,yBAAc,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;YACnD,eAAS,CAAC,QAAQ,CAAC;gBAClB,MAAM,EAAE,UAAU;gBAClB,WAAW,EAAE;oBACZ,SAAS,EAAE,IAAI;iBACf;aACD,CAAC;YACF,uBAAa,CAAC,UAAU,CAAC,CAAC,oCAAgB,CAAC,CAAC;YAC5C,6BAAY;SACZ;QACD,WAAW,EAAE,CAAC,gCAAc,CAAC;QAC7B,SAAS,EAAE;YACV,0BAAW;YACX,8BAAY;SACZ;QACD,OAAO,EAAE,CAAC,0BAAW,EAAE,8BAAY,CAAC;KACpC,CAAC;GACW,UAAU,CAAG;AAAb,gCAAU"} -------------------------------------------------------------------------------- /src/backend/dist/auth/auth.service.d.ts: -------------------------------------------------------------------------------- 1 | import { JwtService } from '@nestjs/jwt'; 2 | import { Player } from '../players/player.entity'; 3 | import { UsersService } from '../players/players.service'; 4 | export declare class AuthService { 5 | private readonly playerService; 6 | private jwtService; 7 | constructor(playerService: UsersService, jwtService: JwtService); 8 | login(req: any, res: any): Promise; 9 | cb(res: any, player: Player): Promise; 10 | logout(id: number, res: any): Promise; 11 | } 12 | -------------------------------------------------------------------------------- /src/backend/dist/auth/jwt-payload.interface.d.ts: -------------------------------------------------------------------------------- 1 | export interface JwtPayload { 2 | username: string; 3 | id: number; 4 | two_fa: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /src/backend/dist/auth/jwt-payload.interface.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=jwt-payload.interface.js.map -------------------------------------------------------------------------------- /src/backend/dist/auth/jwt-payload.interface.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"jwt-payload.interface.js","sourceRoot":"","sources":["../../src/auth/jwt-payload.interface.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /src/backend/dist/auth/jwt.strategy.d.ts: -------------------------------------------------------------------------------- 1 | import { JwtPayload } from "./jwt-payload.interface"; 2 | import { PlayerRepository } from "../players/player.repository"; 3 | import { Player } from "../players/player.entity"; 4 | declare const JwtStrategy_base: new (...args: any[]) => any; 5 | export declare class JwtStrategy extends JwtStrategy_base { 6 | private playerRepository; 7 | constructor(playerRepository: PlayerRepository); 8 | validate(payload: JwtPayload): Promise; 9 | } 10 | export {}; 11 | -------------------------------------------------------------------------------- /src/backend/dist/auth/jwt.strategy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"jwt.strategy.js","sourceRoot":"","sources":["../../src/auth/jwt.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmE;AACnE,+CAAoD;AACpD,6CAAmD;AACnD,+CAAoD;AAEpD,oEAAgE;AAIhE,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,IAAA,2BAAgB,EAAC,uBAAQ,CAAC;IACvD,YAEY,gBAAkC;QAE1C,KAAK,CAAC;YACF,cAAc,EAAE,yBAAU,CAAC,2BAA2B,EAAE;YACxD,WAAW,EAAE,UAAU;SAC1B,CAAC,CAAC;QALK,qBAAgB,GAAhB,gBAAgB,CAAkB;IAM9C,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAmB;QAC9B,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAC7B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,EAAE;YACP,MAAM,IAAI,8BAAqB,EAAE,CAAC;SACrC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAnBY,WAAW;IADvB,IAAA,mBAAU,GAAE;IAGJ,WAAA,IAAA,0BAAgB,EAAC,oCAAgB,CAAC,CAAA;qCACT,oCAAgB;GAHrC,WAAW,CAmBvB;AAnBY,kCAAW"} -------------------------------------------------------------------------------- /src/backend/dist/chat/chat.controller.d.ts: -------------------------------------------------------------------------------- 1 | import { UsersService } from 'src/players/players.service'; 2 | import { ChatService } from './chat.service'; 3 | import { memberDto } from './dto/member-dto'; 4 | import { membership } from './membership.entity'; 5 | import { message } from './message.entity'; 6 | import { chatroom } from './room.entity'; 7 | import { Request } from "express"; 8 | export declare class ChatController { 9 | private chatService; 10 | private usersService; 11 | constructor(chatService: ChatService, usersService: UsersService); 12 | getAllMessageByRoomId(req: Request, roomid: number, playerid: number): Promise; 13 | getMessages(req: Request, userid: number, receiverid: number): Promise; 14 | getMembersByRoomId(req: Request, roomid: number, playerid: number): Promise; 15 | getRoomsByUserId(req: Request, playerid: number): Promise; 16 | getAllRooms(req: Request, playerid: number): Promise; 17 | getMembership(req: Request, roomid: number, playerid: number): Promise; 18 | } 19 | -------------------------------------------------------------------------------- /src/backend/dist/chat/chat.module.d.ts: -------------------------------------------------------------------------------- 1 | export declare class ChatModule { 2 | } 3 | -------------------------------------------------------------------------------- /src/backend/dist/chat/chat.module.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | Object.defineProperty(exports, "__esModule", { value: true }); 9 | exports.ChatModule = void 0; 10 | const common_1 = require("@nestjs/common"); 11 | const typeorm_1 = require("@nestjs/typeorm"); 12 | const chat_gateway_1 = require("./chat.gateway"); 13 | const room_repository_1 = require("./room.repository"); 14 | const chat_service_1 = require("./chat.service"); 15 | const auth_module_1 = require("../auth/auth.module"); 16 | const chat_controller_1 = require("./chat.controller"); 17 | const membership_entity_1 = require("./membership.entity"); 18 | const message_entity_1 = require("./message.entity"); 19 | const player_repository_1 = require("../players/player.repository"); 20 | const relations_module_1 = require("../relations/relations.module"); 21 | let ChatModule = class ChatModule { 22 | }; 23 | ChatModule = __decorate([ 24 | (0, common_1.Module)({ 25 | imports: [auth_module_1.AuthModule, relations_module_1.RelationModule, typeorm_1.TypeOrmModule.forFeature([room_repository_1.roomRepository, player_repository_1.PlayerRepository, membership_entity_1.membership, message_entity_1.message]),], 26 | providers: [chat_gateway_1.ChatGateway, chat_service_1.ChatService], 27 | controllers: [chat_controller_1.ChatController], 28 | }) 29 | ], ChatModule); 30 | exports.ChatModule = ChatModule; 31 | //# sourceMappingURL=chat.module.js.map -------------------------------------------------------------------------------- /src/backend/dist/chat/chat.module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"chat.module.js","sourceRoot":"","sources":["../../src/chat/chat.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAEhD,iDAA6C;AAC7C,uDAAmD;AACnD,iDAA6C;AAC7C,qDAAkD;AAIlD,uDAAmD;AACnD,2DAAiD;AACjD,qDAA2C;AAC3C,oEAAiE;AACjE,oEAAgE;AAShE,IAAa,UAAU,GAAvB,MAAa,UAAU;CAAG,CAAA;AAAb,UAAU;IANtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAC,CAAC,wBAAU,EAAC,iCAAc,EAAG,uBAAa,CAAC,UAAU,CAAC,CAAC,gCAAc,EAAE,oCAAgB,EAAE,8BAAU,EAAE,wBAAO,CAAC,CAAC,EAAE;QACxH,SAAS,EAAE,CAAC,0BAAW,EAAE,0BAAW,CAAC;QACrC,WAAW,EAAE,CAAC,gCAAc,CAAC;KAC9B,CAAC;GAEW,UAAU,CAAG;AAAb,gCAAU"} -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/join-channel-dto.d.ts: -------------------------------------------------------------------------------- 1 | export declare class JoinChannelDto { 2 | roomid: number; 3 | password: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/join-channel-dto.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.JoinChannelDto = void 0; 4 | class JoinChannelDto { 5 | } 6 | exports.JoinChannelDto = JoinChannelDto; 7 | //# sourceMappingURL=join-channel-dto.js.map -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/join-channel-dto.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"join-channel-dto.js","sourceRoot":"","sources":["../../../src/chat/dto/join-channel-dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;CAG1B;AAHD,wCAGC"} -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/member-dto.d.ts: -------------------------------------------------------------------------------- 1 | import { Player } from "src/players/player.entity"; 2 | import { RoleStatus } from "./membership.model"; 3 | export declare class memberDto { 4 | member: Player; 5 | role: RoleStatus; 6 | isbanned: boolean; 7 | ismuted: boolean; 8 | } 9 | -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/member-dto.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.memberDto = void 0; 4 | class memberDto { 5 | } 6 | exports.memberDto = memberDto; 7 | //# sourceMappingURL=member-dto.js.map -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/member-dto.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"member-dto.js","sourceRoot":"","sources":["../../../src/chat/dto/member-dto.ts"],"names":[],"mappings":";;;AAGA,MAAa,SAAS;CAKrB;AALD,8BAKC"} -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/membership-dto.d.ts: -------------------------------------------------------------------------------- 1 | export declare class membershipDto { 2 | userid: number; 3 | roomid: number; 4 | } 5 | -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/membership-dto.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.membershipDto = void 0; 4 | class membershipDto { 5 | } 6 | exports.membershipDto = membershipDto; 7 | //# sourceMappingURL=membership-dto.js.map -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/membership-dto.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"membership-dto.js","sourceRoot":"","sources":["../../../src/chat/dto/membership-dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAa;CAGzB;AAHD,sCAGC"} -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/membership.model.d.ts: -------------------------------------------------------------------------------- 1 | export interface Membership { 2 | id: number; 3 | role: RoleStatus; 4 | } 5 | export declare enum RoleStatus { 6 | ADMIN = "ADMIN", 7 | OWNER = "OWNER", 8 | USER = "USER" 9 | } 10 | -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/membership.model.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.RoleStatus = void 0; 4 | var RoleStatus; 5 | (function (RoleStatus) { 6 | RoleStatus["ADMIN"] = "ADMIN"; 7 | RoleStatus["OWNER"] = "OWNER"; 8 | RoleStatus["USER"] = "USER"; 9 | })(RoleStatus = exports.RoleStatus || (exports.RoleStatus = {})); 10 | //# sourceMappingURL=membership.model.js.map -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/membership.model.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"membership.model.js","sourceRoot":"","sources":["../../../src/chat/dto/membership.model.ts"],"names":[],"mappings":";;;AAMA,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,6BAAe,CAAA;IACf,6BAAe,CAAA;IACf,2BAAa,CAAA;AACjB,CAAC,EAJW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAIrB"} -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/message-dto.d.ts: -------------------------------------------------------------------------------- 1 | export declare class messageDto { 2 | id: number; 3 | content: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/message-dto.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.messageDto = void 0; 4 | class messageDto { 5 | } 6 | exports.messageDto = messageDto; 7 | //# sourceMappingURL=message-dto.js.map -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/message-dto.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"message-dto.js","sourceRoot":"","sources":["../../../src/chat/dto/message-dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,UAAU;CAGtB;AAHD,gCAGC"} -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/mute-dto.d.ts: -------------------------------------------------------------------------------- 1 | export declare class muteDto { 2 | roomid: number; 3 | userid: number; 4 | duration: number; 5 | } 6 | -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/mute-dto.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.muteDto = void 0; 4 | class muteDto { 5 | } 6 | exports.muteDto = muteDto; 7 | //# sourceMappingURL=mute-dto.js.map -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/mute-dto.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"mute-dto.js","sourceRoot":"","sources":["../../../src/chat/dto/mute-dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,OAAO;CAKnB;AALD,0BAKC"} -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/room-dto.d.ts: -------------------------------------------------------------------------------- 1 | export declare class RoomDto { 2 | name: string; 3 | privacy: string; 4 | password: string; 5 | players: any[]; 6 | created_at: Date; 7 | updated_at: Date; 8 | } 9 | -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/room-dto.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.RoomDto = void 0; 4 | class RoomDto { 5 | } 6 | exports.RoomDto = RoomDto; 7 | //# sourceMappingURL=room-dto.js.map -------------------------------------------------------------------------------- /src/backend/dist/chat/dto/room-dto.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"room-dto.js","sourceRoot":"","sources":["../../../src/chat/dto/room-dto.ts"],"names":[],"mappings":";;;AAGA,MAAa,OAAO;CAyBnB;AAzBD,0BAyBC"} -------------------------------------------------------------------------------- /src/backend/dist/chat/membership.entity.d.ts: -------------------------------------------------------------------------------- 1 | import { Player } from "src/players/player.entity"; 2 | import { BaseEntity } from "typeorm"; 3 | import { RoleStatus } from "./dto/membership.model"; 4 | import { chatroom } from "./room.entity"; 5 | export declare class membership extends BaseEntity { 6 | id_membership: number; 7 | role: RoleStatus; 8 | isbanned: boolean; 9 | ismuted: boolean; 10 | playerid: number; 11 | Player: Player; 12 | roomid: number; 13 | room: chatroom; 14 | } 15 | -------------------------------------------------------------------------------- /src/backend/dist/chat/membership.entity.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"membership.entity.js","sourceRoot":"","sources":["../../src/chat/membership.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,4DAAmD;AACnD,qCAA8J;AAC9J,6DAAoD;AACpD,+CAAyC;AAGzC,IAAa,UAAU,GAAvB,MAAa,UAAW,SAAQ,oBAAU;CA2BzC,CAAA;AAxBG;IADC,IAAA,gCAAsB,GAAE;;iDACJ;AAGrB;IADC,IAAA,gBAAM,GAAE;;wCACO;AAGhB;IADC,IAAA,gBAAM,GAAE;;4CACQ;AAGjB;IADC,IAAA,gBAAM,GAAE;;2CACO;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;;4CACZ;AAIjB;IAFC,IAAA,mBAAS,EAAC,GAAE,EAAE,CAAC,sBAAM,EAAE,MAAM,CAAA,EAAE,CAAA,MAAM,CAAC,WAAW,CAAC;IAClD,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;8BACzB,sBAAM;0CAAC;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;0CACZ;AAIf;IAFC,IAAA,mBAAS,EAAC,GAAE,EAAE,CAAC,sBAAQ,EAAE,IAAI,CAAA,EAAE,CAAA,IAAI,CAAC,WAAW,CAAC;IAChD,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAC,QAAQ,EAAC,CAAC;8BACxB,sBAAQ;wCAAC;AA1BL,UAAU;IADtB,IAAA,gBAAM,GAAE;GACI,UAAU,CA2BtB;AA3BY,gCAAU"} -------------------------------------------------------------------------------- /src/backend/dist/chat/message.entity.d.ts: -------------------------------------------------------------------------------- 1 | import { Player } from "src/players/player.entity"; 2 | import { BaseEntity } from "typeorm"; 3 | import { chatroom } from "./room.entity"; 4 | export declare class message extends BaseEntity { 5 | id: number; 6 | content: string; 7 | created_at: Date; 8 | playerid: number; 9 | roomid: number; 10 | room: chatroom; 11 | Player: Player; 12 | } 13 | -------------------------------------------------------------------------------- /src/backend/dist/chat/message.entity.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"message.entity.js","sourceRoot":"","sources":["../../src/chat/message.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,4DAAmD;AACnD,qCAA4J;AAC5J,+CAAyC;AAGzC,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,oBAAU;CAuBtC,CAAA;AArBG;IADC,IAAA,gCAAsB,GAAE;;mCACf;AAGV;IADC,IAAA,gBAAM,GAAE;;wCACM;AAGf;IADC,IAAA,0BAAgB,GAAE;8BACR,IAAI;2CAAC;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;;yCACZ;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;uCACZ;AAIf;IAFC,IAAA,mBAAS,EAAC,GAAE,EAAE,CAAC,sBAAQ,EAAE,IAAI,CAAA,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC9C,IAAA,oBAAU,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,CAAC;8BACvB,sBAAQ;qCAAC;AAId;IAFC,IAAA,mBAAS,EAAC,GAAE,EAAE,CAAC,sBAAM,EAAE,MAAM,CAAA,EAAE,CAAA,MAAM,CAAC,QAAQ,CAAC;IAC/C,IAAA,oBAAU,EAAC,EAAC,IAAI,EAAC,UAAU,EAAC,CAAC;8BACvB,sBAAM;uCAAC;AAtBL,OAAO;IADnB,IAAA,gBAAM,GAAE;GACI,OAAO,CAuBnB;AAvBY,0BAAO"} -------------------------------------------------------------------------------- /src/backend/dist/chat/room.entity.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseEntity } from "typeorm"; 2 | import { message } from "./message.entity"; 3 | import { membership } from "./membership.entity"; 4 | export declare class chatroom extends BaseEntity { 5 | id: number; 6 | name: string; 7 | ischannel: boolean; 8 | ispublic: boolean; 9 | password: string; 10 | salt: string; 11 | memberships: membership[]; 12 | messages: message[]; 13 | create_at: Date; 14 | updated_at: Date; 15 | } 16 | -------------------------------------------------------------------------------- /src/backend/dist/chat/room.entity.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"room.entity.js","sourceRoot":"","sources":["../../src/chat/room.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAAkJ;AAClJ,qDAA2C;AAC3C,2DAAiD;AAGjD,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,oBAAU;CAmCvC,CAAA;AAhCG;IADC,IAAA,gCAAsB,GAAE;;oCACf;AAGV;IADC,IAAA,gBAAM,EAAC,EAAC,MAAM,EAAC,IAAI,EAAC,CAAC;;sCACV;AAGZ;IADC,IAAA,gBAAM,EAAC,EAAC,OAAO,EAAC,IAAI,EAAC,CAAC;;2CACL;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAC,OAAO,EAAC,IAAI,EAAC,CAAC;;0CACN;AAGjB;IADC,IAAA,gBAAM,GAAE;;0CACO;AAGhB;IADC,IAAA,gBAAM,GAAE;;sCACG;AAMZ;IADC,IAAA,mBAAS,EAAC,GAAE,EAAE,CAAA,8BAAU,EAAE,UAAU,CAAA,EAAE,CAAA,UAAU,CAAC,IAAI,CAAC;;6CAC9B;AAGzB;IADC,IAAA,mBAAS,EAAC,GAAE,EAAE,CAAA,wBAAO,EAAE,OAAO,CAAA,EAAE,CAAA,OAAO,CAAC,IAAI,CAAC;;0CAC3B;AAGnB;IADC,IAAA,0BAAgB,GAAE;8BACT,IAAI;2CAAC;AAGf;IADC,IAAA,0BAAgB,GAAE;8BACR,IAAI;4CAAC;AAjCP,QAAQ;IADpB,IAAA,gBAAM,GAAE;GACI,QAAQ,CAmCpB;AAnCY,4BAAQ"} -------------------------------------------------------------------------------- /src/backend/dist/chat/room.repository.d.ts: -------------------------------------------------------------------------------- 1 | import { chatroom } from "./room.entity"; 2 | import { Repository } from "typeorm"; 3 | import { RoomDto } from "./dto/room-dto"; 4 | import { RoleStatus } from "./dto/membership.model"; 5 | import { Player } from "src/players/player.entity"; 6 | export declare class roomRepository extends Repository { 7 | createRoom(RoomDto: RoomDto, creators: Player[]): Promise; 8 | createDM(sender: number, receiver: number): Promise; 9 | addMember(room: chatroom, creator: Player, role: RoleStatus): Promise; 10 | getRoomById(id: number): Promise; 11 | getChatroomById(id: number): Promise; 12 | } 13 | -------------------------------------------------------------------------------- /src/backend/dist/chat/room.repository.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"room.repository.js","sourceRoot":"","sources":["../../src/chat/room.repository.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAyC;AACzC,qCAAuD;AAIvD,2DAAiD;AACjD,6DAAoD;AAEpD,iCAAiC;AAGjC,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,oBAAoB;IAEpD,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,QAAmB;QACjD,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,QAAQ,EAAC,GAAG,OAAO,CAAC;QAExC,MAAM,IAAI,GAAG,IAAI,sBAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,OAAO,KAAK,SAAS;YACrB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAE1B,IAAI,CAAC,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACvD,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAElB,KAAK,IAAI,IAAI,IAAI,QAAQ,EACzB;YACI,MAAM,UAAU,GAAG,IAAI,8BAAU,EAAE,CAAC;YACpC,UAAU,CAAC,IAAI,GAAG,6BAAU,CAAC,IAAI,CAAC;YAClC,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC;YACzB,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;YACvB,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC;YAC5B,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC;YAC3B,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;SAC3B;QAID,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAa,EAAG,QAAe;QAC1C,MAAM,EAAE,GAAG,IAAI,sBAAQ,EAAE,CAAC;QAE1B,EAAE,CAAC,IAAI,GAAG,MAAM,GAAC,GAAG,GAAC,QAAQ,CAAC;QAC9B,EAAE,CAAC,SAAS,GAAG,KAAK,CAAC;QACrB,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC;QACb,EAAE,CAAC,QAAQ,GAAC,EAAE,CAAC;QACf,EAAE,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEpB,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;QAEhB,OAAO,EAAE,CAAC;IACd,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAa,EAAC,OAAe,EAAE,IAAe;QAC1D,MAAM,UAAU,GAAG,IAAI,8BAAU,EAAE,CAAC;QACpC,UAAU,CAAC,IAAI,GAAE,IAAI,CAAC;QACtB,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC;QAC5B,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;QACtB,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC;QAC5B,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC;QAC5B,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,EAAS;QACvB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,EAAC,EAAE,EAAC,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,EAAS;QAC3B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC;aACjD,KAAK,CAAC,eAAe,EAAE,EAAC,EAAE,EAAC,CAAC;aAC5B,MAAM,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC;aACnE,MAAM,EAAE,CAAC;QAEV,OAAO,IAAI,CAAC;IAEhB,CAAC;CAEJ,CAAA;AAtEY,cAAc;IAD1B,IAAA,0BAAgB,EAAC,sBAAQ,CAAC;GACd,cAAc,CAsE1B;AAtEY,wCAAc"} -------------------------------------------------------------------------------- /src/backend/dist/config/logger.middleware.d.ts: -------------------------------------------------------------------------------- 1 | import { NestMiddleware } from "@nestjs/common"; 2 | import { NextFunction, Request, Response } from "express"; 3 | import { UsersService } from "../players/players.service"; 4 | export declare class LoggerMiddleware implements NestMiddleware { 5 | private readonly usersService; 6 | constructor(usersService: UsersService); 7 | use(req: Request, res: Response, next: NextFunction): Promise; 8 | } 9 | -------------------------------------------------------------------------------- /src/backend/dist/config/logger.middleware.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.LoggerMiddleware = void 0; 4 | class LoggerMiddleware { 5 | constructor(usersService) { 6 | this.usersService = usersService; 7 | } 8 | async use(req, res, next) { 9 | next(); 10 | } 11 | } 12 | exports.LoggerMiddleware = LoggerMiddleware; 13 | //# sourceMappingURL=logger.middleware.js.map -------------------------------------------------------------------------------- /src/backend/dist/config/logger.middleware.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"logger.middleware.js","sourceRoot":"","sources":["../../src/config/logger.middleware.ts"],"names":[],"mappings":";;;AAMA,MAAa,gBAAgB;IAC5B,YACkB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IACzC,CAAC;IACH,KAAK,CAAC,GAAG,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB;QAc1D,IAAI,EAAE,CAAC;IACN,CAAC;CACF;AApBD,4CAoBC"} -------------------------------------------------------------------------------- /src/backend/dist/config/typeorm.config.d.ts: -------------------------------------------------------------------------------- 1 | import { TypeOrmModuleOptions } from "@nestjs/typeorm"; 2 | export declare const typeOrmConfig: TypeOrmModuleOptions; 3 | -------------------------------------------------------------------------------- /src/backend/dist/config/typeorm.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.typeOrmConfig = void 0; 4 | const message_entity_1 = require("../chat/message.entity"); 5 | const membership_entity_1 = require("../chat/membership.entity"); 6 | const room_entity_1 = require("../chat/room.entity"); 7 | const player_entity_1 = require("../players/player.entity"); 8 | const relation_entity_1 = require("../relations/relation.entity"); 9 | const game_room_entity_1 = require("../pong-game/typeorm/game-room.entity"); 10 | const game_history_entity_1 = require("../pong-game/typeorm/game-history.entity"); 11 | exports.typeOrmConfig = { 12 | type: 'postgres', 13 | host: '127.0.0.1', 14 | port: 5432, 15 | username: 'ping', 16 | password: 'pong', 17 | database: 'pong_db', 18 | entities: [ 19 | player_entity_1.Player, 20 | relation_entity_1.Relation, 21 | room_entity_1.chatroom, 22 | membership_entity_1.membership, 23 | message_entity_1.message, 24 | game_room_entity_1.GameRoom, 25 | game_history_entity_1.GameHistory 26 | ], 27 | synchronize: true, 28 | logging: false, 29 | autoLoadEntities: true, 30 | }; 31 | //# sourceMappingURL=typeorm.config.js.map -------------------------------------------------------------------------------- /src/backend/dist/config/typeorm.config.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"typeorm.config.js","sourceRoot":"","sources":["../../src/config/typeorm.config.ts"],"names":[],"mappings":";;;AACA,2DAAkD;AAClD,iEAAwD;AACxD,qDAAgD;AAChD,4DAAkD;AAClD,kEAAwD;AACxD,4EAAkE;AAClE,kFAAwE;AAE3D,QAAA,aAAa,GAAyB;IAC/C,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,WAAW;IAEjB,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,SAAS;IAEnB,QAAQ,EAAE;QACN,sBAAM;QACN,0BAAQ;QACR,sBAAQ;QACR,8BAAU;QACV,wBAAO;QACP,2BAAQ;QACR,iCAAW;KACd;IACD,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,KAAK;IACd,gBAAgB,EAAG,IAAI;CAC1B,CAAA"} -------------------------------------------------------------------------------- /src/backend/dist/main.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /src/backend/dist/main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const core_1 = require("@nestjs/core"); 4 | const app_module_1 = require("./app.module"); 5 | const cookieParser = require("cookie-parser"); 6 | async function bootstrap() { 7 | const app = await core_1.NestFactory.create(app_module_1.AppModule); 8 | app.use(cookieParser()); 9 | app.enableCors({ origin: "http://" + process.env.FRONTEND_HOST, credentials: true }); 10 | await app.listen(3001); 11 | } 12 | bootstrap(); 13 | //# sourceMappingURL=main.js.map -------------------------------------------------------------------------------- /src/backend/dist/main.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,6CAAyC;AACzC,8CAA8C;AAG9C,KAAK,UAAU,SAAS;IACvB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAahD,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;IACxB,GAAG,CAAC,UAAU,CAAC,EAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC,CAAC;IAMnF,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AACD,SAAS,EAAE,CAAC"} -------------------------------------------------------------------------------- /src/backend/dist/players/app.gateway.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { OnGatewayConnection, OnGatewayDisconnect } from '@nestjs/websockets'; 3 | import { Server } from 'http'; 4 | import { Socket } from 'socket.io'; 5 | import { UsersService } from './players.service'; 6 | export declare class AppGateway implements OnGatewayConnection, OnGatewayDisconnect { 7 | private usersService; 8 | private connectedUsers; 9 | server: Server; 10 | private logger; 11 | constructor(usersService: UsersService); 12 | handleConnection(client: any): Promise; 13 | handleDisconnect(client: Socket, ...args: any[]): void; 14 | } 15 | -------------------------------------------------------------------------------- /src/backend/dist/players/app.gateway.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"app.gateway.js","sourceRoot":"","sources":["../../src/players/app.gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwC;AACxC,mDAK4B;AAC5B,+BAA8B;AAE9B,uDAAiD;AAGjD,IAAa,UAAU,GAAvB,MAAa,UAAU;IAKtB,YAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;QADtC,WAAM,GAAW,IAAI,eAAM,CAAC,iBAAiB,CAAC,CAAC;QAEtD,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;IAC1B,CAAC;IAGD,KAAK,CAAC,gBAAgB,CAAC,MAAW;QACjC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,IAAI,MAAM,EAAE;YACjD,IAAI;gBACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,WAAqB,CAAC,CAAC;gBAE/F,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC1D,IAAI,KAAK,EAAE;oBACV,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAG,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;oBACvE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;iBACvE;aACD;YAAC,OAAM,GAAG,EAAE;gBACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACvB;SACD;IACF,CAAC;IAED,gBAAgB,CAAC,MAAc,EAAE,GAAG,IAAW;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC;QAEvE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC;QAClF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC3E,CAAC;CACD,CAAA;AA7BmB;IAAlB,IAAA,4BAAe,GAAE;8BAAS,aAAM;0CAAC;AAHtB,UAAU;IADtB,IAAA,6BAAgB,EAAC,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;qCAM9C,8BAAY;GALlC,UAAU,CAgCtB;AAhCY,gCAAU"} -------------------------------------------------------------------------------- /src/backend/dist/players/dto-players/create-player.dto.d.ts: -------------------------------------------------------------------------------- 1 | export declare class CreateUserDto { 2 | username: string; 3 | avatar: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/backend/dist/players/dto-players/create-player.dto.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.CreateUserDto = void 0; 13 | const class_validator_1 = require("class-validator"); 14 | class CreateUserDto { 15 | } 16 | __decorate([ 17 | (0, class_validator_1.IsNotEmpty)(), 18 | (0, class_validator_1.IsString)(), 19 | (0, class_validator_1.MaxLength)(50), 20 | (0, class_validator_1.IsAlphanumeric)(), 21 | __metadata("design:type", String) 22 | ], CreateUserDto.prototype, "username", void 0); 23 | __decorate([ 24 | (0, class_validator_1.IsOptional)(), 25 | (0, class_validator_1.IsString)(), 26 | (0, class_validator_1.MaxLength)(100), 27 | __metadata("design:type", String) 28 | ], CreateUserDto.prototype, "avatar", void 0); 29 | exports.CreateUserDto = CreateUserDto; 30 | //# sourceMappingURL=create-player.dto.js.map -------------------------------------------------------------------------------- /src/backend/dist/players/dto-players/create-player.dto.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"create-player.dto.js","sourceRoot":"","sources":["../../../src/players/dto-players/create-player.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkH;AAElH,MAAa,aAAa;CAsBzB;AAhBG;IAJF,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,EAAE,CAAC;IACb,IAAA,gCAAc,GAAE;;+CACG;AAKpB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,GAAG,CAAC;;6CACA;AAXhB,sCAsBC"} -------------------------------------------------------------------------------- /src/backend/dist/players/dto-players/get-player-filter.dto.d.ts: -------------------------------------------------------------------------------- 1 | import { UserStatus } from "../player_status.enum"; 2 | export declare class GetPlayersFilterDto { 3 | id: number; 4 | username: string; 5 | level: number; 6 | status: UserStatus; 7 | } 8 | -------------------------------------------------------------------------------- /src/backend/dist/players/dto-players/get-player-filter.dto.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.GetPlayersFilterDto = void 0; 13 | const class_validator_1 = require("class-validator"); 14 | const player_status_enum_1 = require("../player_status.enum"); 15 | class GetPlayersFilterDto { 16 | } 17 | __decorate([ 18 | (0, class_validator_1.IsOptional)(), 19 | (0, class_validator_1.IsNotEmpty)(), 20 | (0, class_validator_1.IsNumber)(), 21 | __metadata("design:type", Number) 22 | ], GetPlayersFilterDto.prototype, "id", void 0); 23 | __decorate([ 24 | (0, class_validator_1.IsOptional)(), 25 | (0, class_validator_1.IsString)(), 26 | __metadata("design:type", String) 27 | ], GetPlayersFilterDto.prototype, "username", void 0); 28 | __decorate([ 29 | (0, class_validator_1.IsOptional)(), 30 | (0, class_validator_1.IsNotEmpty)(), 31 | (0, class_validator_1.IsNumber)(), 32 | __metadata("design:type", Number) 33 | ], GetPlayersFilterDto.prototype, "level", void 0); 34 | __decorate([ 35 | (0, class_validator_1.IsOptional)(), 36 | (0, class_validator_1.IsIn)([player_status_enum_1.UserStatus.OFFLINE, player_status_enum_1.UserStatus.ONLINE, player_status_enum_1.UserStatus.PLAYING]), 37 | __metadata("design:type", String) 38 | ], GetPlayersFilterDto.prototype, "status", void 0); 39 | exports.GetPlayersFilterDto = GetPlayersFilterDto; 40 | //# sourceMappingURL=get-player-filter.dto.js.map -------------------------------------------------------------------------------- /src/backend/dist/players/dto-players/get-player-filter.dto.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"get-player-filter.dto.js","sourceRoot":"","sources":["../../../src/players/dto-players/get-player-filter.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmF;AACnF,8DAAmD;AAEnD,MAAa,mBAAmB;CAmB/B;AAdG;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;+CACA;AAIX;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;qDACM;AAKjB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;kDACG;AAId;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,sBAAI,EAAC,CAAC,+BAAU,CAAC,OAAO,EAAE,+BAAU,CAAC,MAAM,EAAE,+BAAU,CAAC,OAAO,CAAC,CAAC;;mDAC/C;AAlBvB,kDAmBC"} -------------------------------------------------------------------------------- /src/backend/dist/players/player.entity.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseEntity } from "typeorm"; 2 | import { UserStatus } from "./player_status.enum"; 3 | import { Relation } from "../relations/relation.entity"; 4 | import { membership } from "src/chat/membership.entity"; 5 | import { message } from "src/chat/message.entity"; 6 | import { GameHistory } from "src/pong-game/typeorm/game-history.entity"; 7 | export declare class Player extends BaseEntity { 8 | id: number; 9 | username: string; 10 | avatar: string; 11 | level: number; 12 | wins: number; 13 | losses: number; 14 | status: UserStatus; 15 | first_time: boolean; 16 | two_fa: boolean; 17 | secret: string; 18 | senders: Relation[]; 19 | memberships: membership[]; 20 | messages: message[]; 21 | gameHistory: GameHistory; 22 | } 23 | -------------------------------------------------------------------------------- /src/backend/dist/players/player.entity.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"player.entity.js","sourceRoot":"","sources":["../../src/players/player.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAyG;AACzG,6DAAkD;AAClD,kEAAwD;AACxD,iEAAwD;AACxD,2DAAkD;AAClD,kFAAwE;AAIxE,IAAa,MAAM,GAAnB,MAAa,MAAO,SAAQ,oBAAU;CAwDrC,CAAA;AArDA;IADC,IAAA,uBAAa,GAAE;;kCACL;AAGX;IADC,IAAA,gBAAM,GAAE;;wCACQ;AAGjB;IADC,IAAA,gBAAM,GAAE;;sCACM;AAGf;IADC,IAAA,gBAAM,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;;qCACT;AAGd;IADC,IAAA,gBAAM,GAAE;;oCACI;AAGb;IADC,IAAA,gBAAM,GAAE;;sCACM;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,+BAAU,CAAC,OAAO,EAAE,CAAC;;sCACrB;AAGnB;IADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;0CACN;AAGpB;IADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;sCACX;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACZ;AAOf;IALC,IAAA,mBAAS,EACT,IAAI,CAAC,EAAE,CAAC,0BAAQ,EAChB,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,EAC3B,EAAC,KAAK,EAAE,IAAI,EAAC,CACb;;uCACmB;AAMjB;IAJF,IAAA,mBAAS,EACT,GAAE,EAAE,CAAC,8BAAU,EACf,UAAU,CAAA,EAAE,CAAA,UAAU,CAAC,MAAM,CAC7B;;2CAC6B;AAM3B;IAJC,IAAA,mBAAS,EACZ,GAAE,EAAE,CAAA,wBAAO,EACX,OAAO,CAAA,EAAE,CAAC,OAAO,CAAC,MAAM,CACxB;;wCACqB;AAMtB;IAJC,IAAA,mBAAS,EACT,GAAG,EAAE,CAAC,iCAAW,EACjB,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,MAAM,CACvD;8BACY,iCAAW;2CAAC;AAvDb,MAAM;IAFlB,IAAA,gBAAM,EAAC,QAAQ,CAAC;IAChB,IAAA,gBAAM,EAAC,CAAC,UAAU,CAAC,CAAC;GACR,MAAM,CAwDlB;AAxDY,wBAAM"} -------------------------------------------------------------------------------- /src/backend/dist/players/player.repository.d.ts: -------------------------------------------------------------------------------- 1 | import { Player } from "./player.entity"; 2 | import { Repository } from "typeorm"; 3 | import { GetPlayersFilterDto } from "./dto-players/get-player-filter.dto"; 4 | export declare class PlayerRepository extends Repository { 5 | getUsers(FilterDto: GetPlayersFilterDto): Promise; 6 | } 7 | -------------------------------------------------------------------------------- /src/backend/dist/players/player.repository.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | Object.defineProperty(exports, "__esModule", { value: true }); 9 | exports.PlayerRepository = void 0; 10 | const player_entity_1 = require("./player.entity"); 11 | const typeorm_1 = require("typeorm"); 12 | let PlayerRepository = class PlayerRepository extends typeorm_1.Repository { 13 | async getUsers(FilterDto) { 14 | const { id, username, level, status } = FilterDto; 15 | const query = this.createQueryBuilder('user'); 16 | if (id) { 17 | query.andWhere('user.id = :id', { id }); 18 | } 19 | if (username) { 20 | query.andWhere('user.username = :username', { username }); 21 | } 22 | if (level) { 23 | query.andWhere('user.level == :level', { level }); 24 | } 25 | if (status) { 26 | query.andWhere('user.status = :status', { status }); 27 | } 28 | const users = await query.getMany().then((user) => { 29 | return (user); 30 | }); 31 | return users; 32 | } 33 | }; 34 | PlayerRepository = __decorate([ 35 | (0, typeorm_1.EntityRepository)(player_entity_1.Player) 36 | ], PlayerRepository); 37 | exports.PlayerRepository = PlayerRepository; 38 | //# sourceMappingURL=player.repository.js.map -------------------------------------------------------------------------------- /src/backend/dist/players/player.repository.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"player.repository.js","sourceRoot":"","sources":["../../src/players/player.repository.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAyC;AACzC,qCAAuD;AAIvD,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,oBAAkB;IAEvD,KAAK,CAAC,QAAQ,CAAC,SAA8B;QAC5C,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;QAClD,MAAM,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,EAAE,EAAE;YACP,KAAK,CAAC,QAAQ,CAAC,eAAe,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;SACvC;QACD,IAAI,QAAQ,EAAE;YACb,KAAK,CAAC,QAAQ,CAAC,2BAA2B,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;SACzD;QACD,IAAI,KAAK,EAAE;YACV,KAAK,CAAC,QAAQ,CAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;SACjD;QACD,IAAI,MAAM,EAAE;YACX,KAAK,CAAC,QAAQ,CAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;SACnD;QACD,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACjD,OAAO,CAAC,IAAI,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACd,CAAC;CA4CD,CAAA;AAjEY,gBAAgB;IAD5B,IAAA,0BAAgB,EAAC,sBAAM,CAAC;GACZ,gBAAgB,CAiE5B;AAjEY,4CAAgB"} -------------------------------------------------------------------------------- /src/backend/dist/players/player_status.enum.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum UserStatus { 2 | ONLINE = "online", 3 | TWOFA = "twofa", 4 | OFFLINE = "offline", 5 | PLAYING = "playing" 6 | } 7 | -------------------------------------------------------------------------------- /src/backend/dist/players/player_status.enum.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.UserStatus = void 0; 4 | var UserStatus; 5 | (function (UserStatus) { 6 | UserStatus["ONLINE"] = "online"; 7 | UserStatus["TWOFA"] = "twofa"; 8 | UserStatus["OFFLINE"] = "offline"; 9 | UserStatus["PLAYING"] = "playing"; 10 | })(UserStatus = exports.UserStatus || (exports.UserStatus = {})); 11 | //# sourceMappingURL=player_status.enum.js.map -------------------------------------------------------------------------------- /src/backend/dist/players/player_status.enum.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"player_status.enum.js","sourceRoot":"","sources":["../../src/players/player_status.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAKX;AALD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACpB,6BAAe,CAAA;IACf,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;AACpB,CAAC,EALW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAKrB"} -------------------------------------------------------------------------------- /src/backend/dist/players/players.controller.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { UsersService } from "./players.service"; 3 | import { GetPlayersFilterDto } from "./dto-players/get-player-filter.dto"; 4 | import { RelationsService } from "../relations/relations.service"; 5 | import { JwtService } from "@nestjs/jwt"; 6 | import { Request } from "express"; 7 | export declare class UsersController { 8 | private readonly usersService; 9 | private readonly relationService; 10 | private jwtService; 11 | constructor(usersService: UsersService, relationService: RelationsService, jwtService: JwtService); 12 | playerAuth(req: Request): Promise<{ 13 | profile: import("./player.entity").Player; 14 | }>; 15 | getProfile(req: Request): Promise<{ 16 | profile: import("./player.entity").Player; 17 | wins: number; 18 | losses: number; 19 | friends: import("./player.entity").Player[]; 20 | blockedUsers: import("./player.entity").Player[]; 21 | achievements: any; 22 | cookie: any; 23 | }>; 24 | getFriendProfile(req: Request, id: number): Promise<{ 25 | profile: import("./player.entity").Player; 26 | friends: import("./player.entity").Player[]; 27 | blockedUsers: import("./player.entity").Player[]; 28 | achievements: any; 29 | }>; 30 | firstTime(req: Request): Promise; 31 | updateUsername(req: Request, username: string): Promise; 32 | updateAvatar(req: Request, imageName: string, avatar: Express.Multer.File): Promise; 33 | updateTwoFa(req: Request): Promise; 34 | twoFactorEnable(req: Request, Password2fa: string): Promise; 35 | twoFactorAuthenticate(req: Request, res: any, code: string): Promise; 36 | getUsers(FilterDto: GetPlayersFilterDto, req: Request): Promise; 37 | } 38 | -------------------------------------------------------------------------------- /src/backend/dist/players/players.module.d.ts: -------------------------------------------------------------------------------- 1 | export declare class PlayerModule { 2 | } 3 | -------------------------------------------------------------------------------- /src/backend/dist/players/players.module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"players.module.js","sourceRoot":"","sources":["../../src/players/players.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,qCAAwC;AACxC,+CAAkD;AAClD,6DAAuD;AACvD,uDAAiD;AACjD,2DAAuD;AACvD,oEAA+D;AAC/D,uDAAmD;AACnD,0EAAsE;AACtE,iEAAwD;AACxD,6DAA0D;AAC1D,+CAA2C;AA2B3C,IAAa,YAAY,GAAzB,MAAa,YAAY;CAAG,CAAA;AAAf,YAAY;IAzBxB,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE;YACL,yBAAc,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;YACnD,eAAS,CAAC,QAAQ,CAAC;gBACf,MAAM,EAAE,UAAU;gBAClB,WAAW,EAAE;oBACrB,SAAS,EAAE,IAAI;iBACN;aACJ,CAAC;YACF,uBAAa,CAAC,UAAU,CAAC;gBACrB,oCAAgB;gBAChB,8BAAU;gBACV,gCAAc;gBACd,wCAAkB;aACrB,CAAC;YACF,iCAAc;SACjB;QACD,WAAW,EAAE,CAAC,oCAAe,CAAC;QAC9B,SAAS,EAAE;YACP,8BAAY;YACZ,0BAAW;YACX,wBAAU;SACb;QACD,OAAO,EAAE,CAAC,8BAAY,CAAC;KAC1B,CAAC;GACW,YAAY,CAAG;AAAf,oCAAY"} -------------------------------------------------------------------------------- /src/backend/dist/players/players.service.d.ts: -------------------------------------------------------------------------------- 1 | import { JwtService } from "@nestjs/jwt"; 2 | import { GetPlayersFilterDto } from "./dto-players/get-player-filter.dto"; 3 | import { Player } from "./player.entity"; 4 | import { PlayerRepository } from "./player.repository"; 5 | import { UserStatus } from "./player_status.enum"; 6 | export declare class UsersService { 7 | private userRepository; 8 | private jwtService; 9 | constructor(userRepository: PlayerRepository, jwtService: JwtService); 10 | getStatusByUserId(id: number): Promise; 11 | getUserById(id: number): Promise; 12 | getUserByUsername(username: string): Promise; 13 | getUserByStatusId(id: number): Promise; 14 | getUsers(FilterDto: GetPlayersFilterDto): Promise; 15 | firstTime(id: number): Promise; 16 | updateUsername(id: number, username: string): Promise; 17 | updateAvatar(id: number, avatar: string): Promise; 18 | updateLevel(id: number, difficult: boolean): Promise; 19 | winsGame(id: number): Promise; 20 | LostGame(id: number): Promise; 21 | updateStatus(id: number, status: UserStatus): Promise; 22 | getAchievements(id: number): Promise; 23 | findPlayer(id: number): Promise; 24 | findOrCreate(id: number, login: string): Promise; 25 | verifyToken(token: string): Promise; 26 | generateSecretQr(user: Player): Promise; 27 | turnOnTwoFactorAuthentication(id: number): Promise; 28 | generateTwoFactorAuthenticationSecret(user: Player): Promise<{ 29 | secret: string; 30 | otpauth_url: string; 31 | }>; 32 | verifyTwoFactorAuthenticationCodeValid(user: Player, code: string): Promise; 33 | } 34 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/default.gateway.d.ts: -------------------------------------------------------------------------------- 1 | import { OnGatewayConnection, OnGatewayDisconnect } from '@nestjs/websockets'; 2 | import { Server, Socket } from 'socket.io'; 3 | import { DefaultService } from './default.service'; 4 | export declare class DefaultGateway implements OnGatewayConnection, OnGatewayDisconnect { 5 | private defaultService; 6 | wss: Server; 7 | private players; 8 | constructor(defaultService: DefaultService); 9 | handleConnection(client: Socket): Promise; 10 | handleDisconnect(client: Socket): Promise; 11 | handleKeyUpPressed(client: Socket): void; 12 | handleKeyDownPressed(client: Socket): void; 13 | handleKeyUpUnpressed(client: Socket): void; 14 | handleKeyDownUnpressed(client: Socket): void; 15 | handlTouchMove(client: Socket, data: { 16 | y: number; 17 | }): void; 18 | } 19 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/default.gateway.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"default.gateway.js","sourceRoot":"","sources":["../../src/pong-game/default.gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mDAM4B;AAC5B,yCAA2C;AAC3C,uDAAmD;AAGnD,IAAa,cAAc,GAA3B,MAAa,cAAc;IAMzB,YAAoB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QAChD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAAc;QACnC,MAAM,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAChF,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAAc;QACnC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;YACzC,OAAO,GAAG,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC;IAGD,kBAAkB,CAAC,MAAc;QAC/B,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;SAChD;IACH,CAAC;IAGD,oBAAoB,CAAC,MAAc;QACjC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,cAAc,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SAClD;IACH,CAAC;IAED,oBAAoB,CAAC,MAAc;QACjC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,cAAc,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SAClD;IACH,CAAC;IAGD,sBAAsB,CAAC,MAAc;QACnC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;SACpD;IACH,CAAC;IAED,cAAc,CAAC,MAAc,EAAE,IAAmB;QAChD,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACnD;IACH,CAAC;CACF,CAAA;AAlDoB;IAAlB,IAAA,4BAAe,GAAE;8BAAM,kBAAM;2CAAC;AAmB/B;IADC,IAAA,6BAAgB,EAAC,cAAc,CAAC;;qCACN,kBAAM;;wDAIhC;AAGD;IADC,IAAA,6BAAgB,EAAC,gBAAgB,CAAC;;qCACN,kBAAM;;0DAIlC;AAED;IADC,IAAA,6BAAgB,EAAC,gBAAgB,CAAC;;qCACN,kBAAM;;0DAIlC;AAGD;IADC,IAAA,6BAAgB,EAAC,kBAAkB,CAAC;;qCACN,kBAAM;;4DAIpC;AAED;IADC,IAAA,6BAAgB,EAAC,WAAW,CAAC;;qCACP,kBAAM;;oDAI5B;AApDU,cAAc;IAD1B,IAAA,6BAAgB,EAAC,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;qCAOzC,gCAAc;GANvC,cAAc,CAqD1B;AArDY,wCAAc"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/default.service.d.ts: -------------------------------------------------------------------------------- 1 | import { Logger } from '@nestjs/common'; 2 | import { Server, Socket } from 'socket.io'; 3 | import { UsersService } from 'src/players/players.service'; 4 | import { PlayGroundInterface } from './interfaces'; 5 | import { PongGameService } from './pong-game.service'; 6 | import { PlayGround } from './utils'; 7 | export declare class DefaultService { 8 | private pongGameService; 9 | private usersService; 10 | readonly logger: Logger; 11 | readonly emptyPlayground: PlayGround; 12 | constructor(pongGameService: PongGameService, usersService: UsersService); 13 | handleGetBackGround(playground: PlayGround): PlayGroundInterface; 14 | handleUserConnected(client: Socket, players: Socket[], wss: Server): void; 15 | handleSpectatorConnected(client: Socket): Promise; 16 | handlePlayerConnected(client: Socket, players: Socket[], wss: Server): Promise; 17 | joinPlayersToGame(first: Socket, second: Socket, wss: Server): void; 18 | gameFinished(first: Socket, second: Socket, playground: PlayGround, wss: Server): Promise; 19 | handleUserDisconnected(wss: Server, client: Socket): Promise; 20 | handleKeyUpPressed(client: Socket): void; 21 | handleKeyDownPressed(client: Socket): void; 22 | handleKeyUpUnpressed(client: Socket): void; 23 | handleKeyDownUnpressed(client: Socket): void; 24 | handleTouchMove(client: Socket, data: { 25 | y: number; 26 | }): void; 27 | } 28 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/difficult.gateway.d.ts: -------------------------------------------------------------------------------- 1 | import { OnGatewayConnection, OnGatewayDisconnect } from '@nestjs/websockets'; 2 | import { Server, Socket } from 'socket.io'; 3 | import { DifficultService } from './difficult.service'; 4 | export declare class DifficultGateway implements OnGatewayConnection, OnGatewayDisconnect { 5 | private difficultService; 6 | wss: Server; 7 | private players; 8 | constructor(difficultService: DifficultService); 9 | handleConnection(client: Socket): Promise; 10 | handleDisconnect(client: Socket): Promise; 11 | handleKeyUpPressed(client: Socket): void; 12 | handleKeyDownPressed(client: Socket): void; 13 | handleKeyUpUnpressed(client: Socket): void; 14 | handleKeyDownUnpressed(client: Socket): void; 15 | handlTouchMove(client: Socket, data: { 16 | y: number; 17 | }): void; 18 | } 19 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/difficult.gateway.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"difficult.gateway.js","sourceRoot":"","sources":["../../src/pong-game/difficult.gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mDAM4B;AAC5B,yCAA2C;AAC3C,2DAAuD;AAGvD,IAAa,gBAAgB,GAA7B,MAAa,gBAAgB;IAM3B,YAAoB,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;QACpD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAAc;QACnC,MAAM,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAClF,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAAc;QACnC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;YACzC,OAAO,GAAG,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IAGD,kBAAkB,CAAC,MAAc;QAC/B,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;SAClD;IACH,CAAC;IAGD,oBAAoB,CAAC,MAAc;QACjC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SACpD;IACH,CAAC;IAED,oBAAoB,CAAC,MAAc;QACjC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SACpD;IACH,CAAC;IAGD,sBAAsB,CAAC,MAAc;QACnC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;SACtD;IACH,CAAC;IAED,cAAc,CAAC,MAAc,EAAE,IAAmB;QAChD,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACrD;IACH,CAAC;CACF,CAAA;AAlDoB;IAAlB,IAAA,4BAAe,GAAE;8BAAM,kBAAM;6CAAC;AAmB/B;IADC,IAAA,6BAAgB,EAAC,cAAc,CAAC;;qCACN,kBAAM;;0DAIhC;AAGD;IADC,IAAA,6BAAgB,EAAC,gBAAgB,CAAC;;qCACN,kBAAM;;4DAIlC;AAED;IADC,IAAA,6BAAgB,EAAC,gBAAgB,CAAC;;qCACN,kBAAM;;4DAIlC;AAGD;IADC,IAAA,6BAAgB,EAAC,kBAAkB,CAAC;;qCACN,kBAAM;;8DAIpC;AAED;IADC,IAAA,6BAAgB,EAAC,WAAW,CAAC;;qCACP,kBAAM;;sDAI5B;AApDU,gBAAgB;IAD5B,IAAA,6BAAgB,EAAC,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;qCAO3C,oCAAgB;GAN3C,gBAAgB,CAqD5B;AArDY,4CAAgB"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/difficult.service.d.ts: -------------------------------------------------------------------------------- 1 | import { Logger } from '@nestjs/common'; 2 | import { Server, Socket } from 'socket.io'; 3 | import { UsersService } from 'src/players/players.service'; 4 | import { PlayGroundInterface } from './interfaces'; 5 | import { PongGameService } from './pong-game.service'; 6 | import { PlayGround } from './utils'; 7 | export declare class DifficultService { 8 | private pongGameService; 9 | private usersService; 10 | readonly logger: Logger; 11 | readonly emptyPlayground: PlayGround; 12 | constructor(pongGameService: PongGameService, usersService: UsersService); 13 | handleGetBackGround(playground: PlayGround): PlayGroundInterface; 14 | handleUserConnected(client: Socket, players: Socket[], wss: Server): void; 15 | handleSpectatorConnected(client: Socket): Promise; 16 | handlePlayerConnected(client: Socket, players: Socket[], wss: Server): Promise; 17 | joinPlayersToGame(first: Socket, second: Socket, wss: Server): void; 18 | gameFinished(first: Socket, second: Socket, playground: PlayGround, wss: Server): Promise; 19 | handleUserDisconnected(wss: Server, client: Socket): Promise; 20 | handleKeyUpPressed(client: Socket): void; 21 | handleKeyDownPressed(client: Socket): void; 22 | handleKeyUpUnpressed(client: Socket): void; 23 | handleKeyDownUnpressed(client: Socket): void; 24 | handleTouchMove(client: Socket, data: { 25 | y: number; 26 | }): void; 27 | } 28 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/dto/createGameHistory.dto.d.ts: -------------------------------------------------------------------------------- 1 | import { Player } from '../../players/player.entity'; 2 | import { GameMood } from '../interfaces'; 3 | export declare class CreateGameHistoryDto { 4 | mode: GameMood; 5 | winner: Player; 6 | loser: Player; 7 | winnerScore: number; 8 | loserScore: number; 9 | } 10 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/dto/createGameHistory.dto.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"createGameHistory.dto.js","sourceRoot":"","sources":["../../../src/pong-game/dto/createGameHistory.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuE;AACvE,+DAAqD;AACrD,8CAAyC;AAEzC,MAAa,oBAAoB;CAkBhC;AAfC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,sBAAI,EAAC,CAAE,qBAAQ,CAAC,OAAO,EAAE,qBAAQ,CAAC,SAAS,EAAE,qBAAQ,CAAC,OAAO,CAAE,CAAC;;kDAClD;AAGf;IADC,IAAA,4BAAU,GAAE;8BACL,sBAAM;oDAAC;AAGf;IADC,IAAA,4BAAU,GAAE;8BACN,sBAAM;mDAAC;AAId;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;yDACS;AAIpB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;wDACQ;AAjBrB,oDAkBC"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/dto/createGameRoom.dto.d.ts: -------------------------------------------------------------------------------- 1 | import { GameMood } from '../interfaces'; 2 | export declare class CreateGameRoomDto { 3 | roomname: string; 4 | difficulty: GameMood; 5 | player1: string; 6 | player2: string; 7 | } 8 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/dto/createGameRoom.dto.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.CreateGameRoomDto = void 0; 13 | const class_validator_1 = require("class-validator"); 14 | const interfaces_1 = require("../interfaces"); 15 | class CreateGameRoomDto { 16 | } 17 | __decorate([ 18 | (0, class_validator_1.IsNotEmpty)(), 19 | __metadata("design:type", String) 20 | ], CreateGameRoomDto.prototype, "roomname", void 0); 21 | __decorate([ 22 | (0, class_validator_1.IsNotEmpty)(), 23 | (0, class_validator_1.IsIn)([interfaces_1.GameMood.DEFAULT, interfaces_1.GameMood.DIFFICULT, interfaces_1.GameMood.ONEVONE]), 24 | __metadata("design:type", String) 25 | ], CreateGameRoomDto.prototype, "difficulty", void 0); 26 | __decorate([ 27 | (0, class_validator_1.IsNotEmpty)(), 28 | (0, class_validator_1.IsString)(), 29 | __metadata("design:type", String) 30 | ], CreateGameRoomDto.prototype, "player1", void 0); 31 | __decorate([ 32 | (0, class_validator_1.IsNotEmpty)(), 33 | (0, class_validator_1.IsString)(), 34 | __metadata("design:type", String) 35 | ], CreateGameRoomDto.prototype, "player2", void 0); 36 | exports.CreateGameRoomDto = CreateGameRoomDto; 37 | //# sourceMappingURL=createGameRoom.dto.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/dto/createGameRoom.dto.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"createGameRoom.dto.js","sourceRoot":"","sources":["../../../src/pong-game/dto/createGameRoom.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA6D;AAC7D,8CAAyC;AAEzC,MAAa,iBAAiB;CAe7B;AAbC;IADC,IAAA,4BAAU,GAAE;;mDACI;AAIjB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,sBAAI,EAAC,CAAE,qBAAQ,CAAC,OAAO,EAAE,qBAAQ,CAAC,SAAS,EAAE,qBAAQ,CAAC,OAAO,CAAE,CAAC;;qDAC3C;AAItB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;kDACK;AAIhB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;kDACK;AAdlB,8CAeC"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/Ball.d.ts: -------------------------------------------------------------------------------- 1 | export interface BallInterface { 2 | x: number; 3 | y: number; 4 | speed: number; 5 | velocityX: number; 6 | velocityY: number; 7 | radius: number; 8 | color: string; 9 | } 10 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/Ball.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=Ball.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/Ball.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Ball.js","sourceRoot":"","sources":["../../../src/pong-game/interfaces/Ball.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/Paddle.d.ts: -------------------------------------------------------------------------------- 1 | export interface PaddleInterface { 2 | x: number; 3 | y: number; 4 | width: number; 5 | height: number; 6 | color: string; 7 | } 8 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/Paddle.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=Paddle.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/Paddle.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Paddle.js","sourceRoot":"","sources":["../../../src/pong-game/interfaces/Paddle.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/Player.d.ts: -------------------------------------------------------------------------------- 1 | export interface PlayerInterface { 2 | id: number; 3 | name: string; 4 | avatar: string; 5 | } 6 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/Player.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=Player.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/Player.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Player.js","sourceRoot":"","sources":["../../../src/pong-game/interfaces/Player.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/Playground.d.ts: -------------------------------------------------------------------------------- 1 | import { PaddleInterface } from './Paddle'; 2 | import { BallInterface } from './Ball'; 3 | import { ScoreBoardInterface } from './ScoreBoard'; 4 | export interface PlayGroundInterface { 5 | x: number; 6 | y: number; 7 | width: number; 8 | height: number; 9 | color: string; 10 | leftPaddle: PaddleInterface; 11 | rightPaddle: PaddleInterface; 12 | ball: BallInterface; 13 | score: ScoreBoardInterface; 14 | player1: string; 15 | player2: string; 16 | } 17 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/Playground.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=Playground.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/Playground.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Playground.js","sourceRoot":"","sources":["../../../src/pong-game/interfaces/Playground.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/ScoreBoard.d.ts: -------------------------------------------------------------------------------- 1 | export interface ScoreBoardInterface { 2 | playerOneScore: number; 3 | playerTwoScore: number; 4 | round: number; 5 | } 6 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/ScoreBoard.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=ScoreBoard.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/ScoreBoard.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ScoreBoard.js","sourceRoot":"","sources":["../../../src/pong-game/interfaces/ScoreBoard.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/game_mood.enum.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum GameMood { 2 | DEFAULT = "default", 3 | DIFFICULT = "difficult", 4 | ONEVONE = "oneVone" 5 | } 6 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/game_mood.enum.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.GameMood = void 0; 4 | var GameMood; 5 | (function (GameMood) { 6 | GameMood["DEFAULT"] = "default"; 7 | GameMood["DIFFICULT"] = "difficult"; 8 | GameMood["ONEVONE"] = "oneVone"; 9 | })(GameMood = exports.GameMood || (exports.GameMood = {})); 10 | ; 11 | //# sourceMappingURL=game_mood.enum.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/game_mood.enum.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"game_mood.enum.js","sourceRoot":"","sources":["../../../src/pong-game/interfaces/game_mood.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAIX;AAJD,WAAY,QAAQ;IAChB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,+BAAmB,CAAA;AACvB,CAAC,EAJW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAInB;AAAA,CAAC"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Paddle'; 2 | export * from './Ball'; 3 | export * from './Playground'; 4 | export * from './ScoreBoard'; 5 | export * from './Player'; 6 | export * from './game_mood.enum'; 7 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 3 | if (k2 === undefined) k2 = k; 4 | var desc = Object.getOwnPropertyDescriptor(m, k); 5 | if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 6 | desc = { enumerable: true, get: function() { return m[k]; } }; 7 | } 8 | Object.defineProperty(o, k2, desc); 9 | }) : (function(o, m, k, k2) { 10 | if (k2 === undefined) k2 = k; 11 | o[k2] = m[k]; 12 | })); 13 | var __exportStar = (this && this.__exportStar) || function(m, exports) { 14 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 15 | }; 16 | Object.defineProperty(exports, "__esModule", { value: true }); 17 | __exportStar(require("./Paddle"), exports); 18 | __exportStar(require("./Ball"), exports); 19 | __exportStar(require("./Playground"), exports); 20 | __exportStar(require("./ScoreBoard"), exports); 21 | __exportStar(require("./Player"), exports); 22 | __exportStar(require("./game_mood.enum"), exports); 23 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/interfaces/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pong-game/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,yCAAuB;AACvB,+CAA6B;AAC7B,+CAA6B;AAC7B,2CAAyB;AACzB,mDAAiC"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/one-v-one.gateway.d.ts: -------------------------------------------------------------------------------- 1 | import { OnGatewayConnection, OnGatewayDisconnect } from '@nestjs/websockets'; 2 | import { Server, Socket } from 'socket.io'; 3 | import { OneVOneService } from './one-v-one.service'; 4 | export declare class OneVOneGateway implements OnGatewayConnection, OnGatewayDisconnect { 5 | private onevoneService; 6 | wss: Server; 7 | private players; 8 | constructor(onevoneService: OneVOneService); 9 | handleConnection(client: Socket): Promise; 10 | handleDisconnect(client: Socket): Promise; 11 | handleKeyUpPressed(client: Socket): void; 12 | handleKeyDownPressed(client: Socket): void; 13 | handleKeyUpUnpressed(client: Socket): void; 14 | handleKeyDownUnpressed(client: Socket): void; 15 | handlTouchMove(client: Socket, data: { 16 | y: number; 17 | }): void; 18 | } 19 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/one-v-one.gateway.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"one-v-one.gateway.js","sourceRoot":"","sources":["../../src/pong-game/one-v-one.gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mDAM4B;AAC5B,yCAA2C;AAC3C,2DAAqD;AAGrD,IAAa,cAAc,GAA3B,MAAa,cAAc;IAMzB,YAAoB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QAChD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAAc;QACnC,MAAM,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAChF,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAAc;QACnC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;YACzC,OAAO,GAAG,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC;IAGD,kBAAkB,CAAC,MAAc;QAC/B,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;SAChD;IACH,CAAC;IAGD,oBAAoB,CAAC,MAAc;QACjC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,cAAc,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SAClD;IACH,CAAC;IAED,oBAAoB,CAAC,MAAc;QACjC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,cAAc,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SAClD;IACH,CAAC;IAGD,sBAAsB,CAAC,MAAc;QACnC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;SACpD;IACH,CAAC;IAED,cAAc,CAAC,MAAc,EAAE,IAAmB;QAChD,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACnD;IACH,CAAC;CACF,CAAA;AAlDoB;IAAlB,IAAA,4BAAe,GAAE;8BAAM,kBAAM;2CAAC;AAmB/B;IADC,IAAA,6BAAgB,EAAC,cAAc,CAAC;;qCACN,kBAAM;;wDAIhC;AAGD;IADC,IAAA,6BAAgB,EAAC,gBAAgB,CAAC;;qCACN,kBAAM;;0DAIlC;AAED;IADC,IAAA,6BAAgB,EAAC,gBAAgB,CAAC;;qCACN,kBAAM;;0DAIlC;AAGD;IADC,IAAA,6BAAgB,EAAC,kBAAkB,CAAC;;qCACN,kBAAM;;4DAIpC;AAED;IADC,IAAA,6BAAgB,EAAC,WAAW,CAAC;;qCACP,kBAAM;;oDAI5B;AApDU,cAAc;IAD1B,IAAA,6BAAgB,EAAC,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;qCAOzC,kCAAc;GANvC,cAAc,CAqD1B;AArDY,wCAAc"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/one-v-one.service.d.ts: -------------------------------------------------------------------------------- 1 | import { Logger } from '@nestjs/common'; 2 | import { Server, Socket } from 'socket.io'; 3 | import { UsersService } from 'src/players/players.service'; 4 | import { PlayGroundInterface } from './interfaces'; 5 | import { PongGameService } from './pong-game.service'; 6 | import { PlayGround } from './utils'; 7 | export declare class OneVOneService { 8 | private pongGameService; 9 | private usersService; 10 | readonly logger: Logger; 11 | readonly emptyPlayground: PlayGround; 12 | constructor(pongGameService: PongGameService, usersService: UsersService); 13 | handleGetBackGround(playground: PlayGround): PlayGroundInterface; 14 | handleUserConnected(client: Socket, players: Socket[], wss: Server): void; 15 | handleSpectatorConnected(client: Socket): Promise; 16 | handlePlayerConnected(client: Socket, players: Socket[], wss: Server): Promise; 17 | joinPlayersToGame(first: Socket, second: Socket, wss: Server): void; 18 | gameFinished(first: Socket, second: Socket, playground: PlayGround, wss: Server): Promise; 19 | handleUserDisconnected(wss: Server, client: Socket): Promise; 20 | handleKeyUpPressed(client: Socket): void; 21 | handleKeyDownPressed(client: Socket): void; 22 | handleKeyUpUnpressed(client: Socket): void; 23 | handleKeyDownUnpressed(client: Socket): void; 24 | handleTouchMove(client: Socket, data: { 25 | y: number; 26 | }): void; 27 | } 28 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/pong-game.controller.d.ts: -------------------------------------------------------------------------------- 1 | import { PongGameService } from './pong-game.service'; 2 | import { GameHistory } from './typeorm/game-history.entity'; 3 | import { GameRoom } from './typeorm/game-room.entity'; 4 | export declare class PongGameController { 5 | private pongGameService; 6 | constructor(pongGameService: PongGameService); 7 | getRooms(): Promise<{ 8 | gamesRooms: GameRoom[]; 9 | }>; 10 | getGamesHistory(id: number): Promise<{ 11 | gamesHistory: GameHistory[]; 12 | }>; 13 | } 14 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/pong-game.controller.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"pong-game.controller.js","sourceRoot":"","sources":["../../src/pong-game/pong-game.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAgG;AAChG,2DAAsD;AAKtD,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAC7B,YAAoB,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAGxD,KAAK,CAAC,QAAQ;QACZ,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;IAC/C,CAAC;IAID,KAAK,CAAC,eAAe,CAA6B,EAAU;QAC1D,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACxD,CAAC;CACF,CAAA;AATC;IADC,IAAA,YAAG,EAAC,cAAc,CAAC;;;;kDAGnB;AAID;IAFC,IAAA,YAAG,EAAC,oBAAoB,CAAC;IACzB,IAAA,iBAAQ,EAAC,uBAAc,CAAC;IACD,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;;;;yDAEhD;AAZU,kBAAkB;IAD9B,IAAA,mBAAU,EAAC,WAAW,CAAC;qCAEe,mCAAe;GADzC,kBAAkB,CAa9B;AAbY,gDAAkB"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/pong-game.module.d.ts: -------------------------------------------------------------------------------- 1 | export declare class PongGameModule { 2 | } 3 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/pong-game.module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"pong-game.module.js","sourceRoot":"","sources":["../../src/pong-game/pong-game.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,uDAAmD;AACnD,uDAAmD;AACnD,2DAAqD;AACrD,2DAAuD;AACvD,2DAAuD;AACvD,iEAA4D;AAC5D,2DAAsD;AACtD,iEAAsD;AACtD,qDAAkD;AAClD,2DAAqD;AACrD,uEAA4D;AAkB5D,IAAa,cAAc,GAA3B,MAAa,cAAc;CAAG,CAAA;AAAjB,cAAc;IAhB1B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,UAAU,CAAC,CAAC,2BAAQ,EAAE,iCAAW,CAAC,CAAC;YACjD,wBAAU;SACX;QACD,WAAW,EAAE,CAAC,yCAAkB,CAAC;QACjC,SAAS,EAAE;YACT,mCAAe;YACf,gCAAc;YACd,kCAAc;YACd,oCAAgB;YAChB,gCAAc;YACd,oCAAgB;YAChB,kCAAc;SACf;KACF,CAAC;GACW,cAAc,CAAG;AAAjB,wCAAc"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/pong-game.service.d.ts: -------------------------------------------------------------------------------- 1 | import { GameRoom } from './typeorm/game-room.entity'; 2 | import { Repository } from 'typeorm'; 3 | import { CreateGameRoomDto } from './dto/createGameRoom.dto'; 4 | import { GameHistory } from './typeorm/game-history.entity'; 5 | import { CreateGameHistoryDto } from './dto/createGameHistory.dto'; 6 | export declare class PongGameService { 7 | private roomRepository; 8 | private gameRepository; 9 | constructor(roomRepository: Repository, gameRepository: Repository); 10 | getRooms(): Promise<{ 11 | gamesRooms: GameRoom[]; 12 | }>; 13 | addRoom(Createroom: CreateGameRoomDto): Promise; 14 | deleteRoom(roomname: string): Promise; 15 | getGamesHistory(id: number): Promise<{ 16 | gamesHistory: GameHistory[]; 17 | }>; 18 | addGameHistory(createGameHistoryDto: CreateGameHistoryDto): Promise; 19 | } 20 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/typeorm/game-history.entity.d.ts: -------------------------------------------------------------------------------- 1 | import { Player } from '../../players/player.entity'; 2 | import { GameMood } from '../interfaces'; 3 | export declare class GameHistory { 4 | id: number; 5 | mode: GameMood; 6 | winner: Player; 7 | loser: Player; 8 | winnerScore: number; 9 | loserScore: number; 10 | createdAt: Date; 11 | } 12 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/typeorm/game-history.entity.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"game-history.entity.js","sourceRoot":"","sources":["../../../src/pong-game/typeorm/game-history.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA0G;AAC1G,+DAAqD;AACrD,8CAAyC;AAGzC,IAAa,WAAW,GAAxB,MAAa,WAAW;CAqBvB,CAAA;AAnBC;IADC,IAAA,gCAAsB,GAAE;;uCACd;AAGX;IADC,IAAA,gBAAM,GAAE;;yCACM;AAGf;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,sBAAM,CAAC;8BAChB,sBAAM;2CAAC;AAGf;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,sBAAM,CAAC;8BACjB,sBAAM;0CAAC;AAGd;IADC,IAAA,gBAAM,GAAE;;gDACW;AAGpB;IADC,IAAA,gBAAM,GAAE;;+CACU;AAGnB;IADC,IAAA,0BAAgB,GAAE;8BACR,IAAI;8CAAC;AApBL,WAAW;IADvB,IAAA,gBAAM,GAAE;GACI,WAAW,CAqBvB;AArBY,kCAAW"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/typeorm/game-room.entity.d.ts: -------------------------------------------------------------------------------- 1 | import { GameMood } from '../interfaces'; 2 | export declare class GameRoom { 3 | id: number; 4 | roomname: string; 5 | difficulty: GameMood; 6 | player1: string; 7 | player2: string; 8 | } 9 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/typeorm/game-room.entity.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.GameRoom = void 0; 13 | const typeorm_1 = require("typeorm"); 14 | const interfaces_1 = require("../interfaces"); 15 | let GameRoom = class GameRoom { 16 | }; 17 | __decorate([ 18 | (0, typeorm_1.PrimaryGeneratedColumn)(), 19 | __metadata("design:type", Number) 20 | ], GameRoom.prototype, "id", void 0); 21 | __decorate([ 22 | (0, typeorm_1.Column)(), 23 | __metadata("design:type", String) 24 | ], GameRoom.prototype, "roomname", void 0); 25 | __decorate([ 26 | (0, typeorm_1.Column)(), 27 | __metadata("design:type", String) 28 | ], GameRoom.prototype, "difficulty", void 0); 29 | __decorate([ 30 | (0, typeorm_1.Column)(), 31 | __metadata("design:type", String) 32 | ], GameRoom.prototype, "player1", void 0); 33 | __decorate([ 34 | (0, typeorm_1.Column)(), 35 | __metadata("design:type", String) 36 | ], GameRoom.prototype, "player2", void 0); 37 | GameRoom = __decorate([ 38 | (0, typeorm_1.Entity)() 39 | ], GameRoom); 40 | exports.GameRoom = GameRoom; 41 | //# sourceMappingURL=game-room.entity.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/typeorm/game-room.entity.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"game-room.entity.js","sourceRoot":"","sources":["../../../src/pong-game/typeorm/game-room.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAiE;AACjE,8CAAyC;AAGzC,IAAa,QAAQ,GAArB,MAAa,QAAQ;CAgBpB,CAAA;AAdC;IADC,IAAA,gCAAsB,GAAE;;oCACd;AAGX;IADC,IAAA,gBAAM,GAAE;;0CACQ;AAGjB;IADC,IAAA,gBAAM,GAAE;;4CACY;AAGrB;IADC,IAAA,gBAAM,GAAE;;yCACO;AAGhB;IADC,IAAA,gBAAM,GAAE;;yCACO;AAdL,QAAQ;IADpB,IAAA,gBAAM,GAAE;GACI,QAAQ,CAgBpB;AAhBY,4BAAQ"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/Ball.d.ts: -------------------------------------------------------------------------------- 1 | import { BallInterface } from '../interfaces'; 2 | import { Bounds } from './Bounds'; 3 | import { Paddle } from './Paddle'; 4 | export declare class Ball { 5 | private _x; 6 | private _y; 7 | private _radius; 8 | private _speed; 9 | private _velocityX; 10 | private _velocityY; 11 | private _color; 12 | constructor(x: number, y: number, radius: number, color: string, difficult: boolean); 13 | get x(): number; 14 | get y(): number; 15 | get radius(): number; 16 | get speed(): number; 17 | get velocityX(): number; 18 | get velocityY(): number; 19 | get color(): string; 20 | set X(value: number); 21 | set Y(value: number); 22 | set Radius(value: number); 23 | set Color(value: string); 24 | get bounds(): Bounds; 25 | collision(paddle: Paddle): boolean; 26 | update(pWidth: number, pHeight: number, lPaddle: Paddle, rPaddle: Paddle): void; 27 | getBallInterface(): BallInterface; 28 | reset(xc: number, yc: number, difficult: boolean): void; 29 | } 30 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/Bounds.d.ts: -------------------------------------------------------------------------------- 1 | export interface Bounds { 2 | left: number; 3 | right: number; 4 | upper: number; 5 | lower: number; 6 | } 7 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/Bounds.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=Bounds.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/Bounds.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Bounds.js","sourceRoot":"","sources":["../../../src/pong-game/utils/Bounds.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/Paddle.d.ts: -------------------------------------------------------------------------------- 1 | import { PaddleInterface } from '../interfaces'; 2 | import { Bounds } from './Bounds'; 3 | export declare class Paddle { 4 | private _x; 5 | private _y; 6 | private _xStartPos; 7 | private _yStartPos; 8 | private _width; 9 | private _height; 10 | private _color; 11 | private _difficult; 12 | constructor(x: number, y: number, width: number, height: number, color: string, difficult: boolean); 13 | get x(): number; 14 | get y(): number; 15 | get width(): number; 16 | get height(): number; 17 | get color(): string; 18 | set X(value: number); 19 | set Y(value: number); 20 | set Width(value: number); 21 | set Height(value: number); 22 | set Color(value: string); 23 | get bounds(): Bounds; 24 | getPaddleInterface(): PaddleInterface; 25 | update(valueX: number, valueY: number): void; 26 | moveUp(bounds: Bounds): void; 27 | moveDown(bounds: Bounds): void; 28 | touchMove(y: number, bounds: Bounds): void; 29 | reset(): void; 30 | } 31 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/PaddleController.d.ts: -------------------------------------------------------------------------------- 1 | import { Bounds } from './Bounds'; 2 | import { Paddle } from './Paddle'; 3 | export declare class PaddleController { 4 | private _paddle; 5 | private _isKeyUpPressed; 6 | private _isKeyDownPressed; 7 | constructor(paddle: Paddle); 8 | keyUpPressed(): void; 9 | keyUpUnpressed(): void; 10 | keyDownPressed(): void; 11 | keyDownUnpressed(): void; 12 | get velocity(): number; 13 | update(bounds: Bounds): void; 14 | } 15 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/PaddleController.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.PaddleController = void 0; 4 | class PaddleController { 5 | constructor(paddle) { 6 | this._paddle = paddle; 7 | this._isKeyUpPressed = false; 8 | this._isKeyDownPressed = false; 9 | } 10 | keyUpPressed() { 11 | this._isKeyUpPressed = true; 12 | } 13 | keyUpUnpressed() { 14 | this._isKeyUpPressed = false; 15 | } 16 | keyDownPressed() { 17 | this._isKeyDownPressed = true; 18 | } 19 | keyDownUnpressed() { 20 | this._isKeyDownPressed = false; 21 | } 22 | get velocity() { 23 | let velocity = 0; 24 | if (this._isKeyUpPressed) 25 | velocity -= 1; 26 | if (this._isKeyDownPressed) 27 | velocity += 1; 28 | return velocity; 29 | } 30 | update(bounds) { 31 | if (this.velocity > 0) { 32 | this._paddle.moveDown(bounds); 33 | } 34 | else if (this.velocity) { 35 | this._paddle.moveUp(bounds); 36 | } 37 | } 38 | } 39 | exports.PaddleController = PaddleController; 40 | //# sourceMappingURL=PaddleController.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/PaddleController.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"PaddleController.js","sourceRoot":"","sources":["../../../src/pong-game/utils/PaddleController.ts"],"names":[],"mappings":";;;AAGA,MAAa,gBAAgB;IAI3B,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;IACjC,CAAC;IACD,YAAY;QACV,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;IACD,cAAc;QACZ,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAChC,CAAC;IACD,gBAAgB;QACd,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,IAAI,QAAQ;QACV,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,IAAI,CAAC,eAAe;YAAE,QAAQ,IAAI,CAAC,CAAC;QACxC,IAAI,IAAI,CAAC,iBAAiB;YAAE,QAAQ,IAAI,CAAC,CAAC;QAC1C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,MAAc;QACnB,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE;YACrB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SAC/B;aAAM,IAAI,IAAI,CAAC,QAAQ,EAAE;YACxB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAC7B;IACH,CAAC;CACF;AArCD,4CAqCC"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/PlayGround.d.ts: -------------------------------------------------------------------------------- 1 | import { PlayGroundInterface } from '../interfaces'; 2 | import { Ball } from './Ball'; 3 | import { Bounds } from './Bounds'; 4 | import { Paddle } from './Paddle'; 5 | import { PaddleController } from './PaddleController'; 6 | import { ScoreBoard } from './ScoreBoard'; 7 | export declare class PlayGround { 8 | private _x; 9 | private _y; 10 | private _width; 11 | private _height; 12 | private _color; 13 | private _ball; 14 | private _leftPaddle; 15 | private _rightPaddle; 16 | private _leftPaddleController; 17 | private _rightPaddleController; 18 | private _scoreBoard; 19 | private _win_score; 20 | private _difficult; 21 | private _player1; 22 | private _player2; 23 | constructor(x: number, y: number, width: number, height: number, color: string, win_score: number, difficult: boolean, player1: string, player2: string); 24 | get x(): number; 25 | get y(): number; 26 | get width(): number; 27 | get height(): number; 28 | get color(): string; 29 | get ball(): Ball; 30 | get leftPaddle(): Paddle; 31 | get rightPaddle(): Paddle; 32 | get leftPaddleController(): PaddleController; 33 | get rightPaddleController(): PaddleController; 34 | get win_score(): number; 35 | get player1(): string; 36 | get player2(): string; 37 | private getRadius; 38 | private getPaddleWidth; 39 | private getPaddleHeight; 40 | getPlayGroundInterface(): PlayGroundInterface; 41 | get bounds(): Bounds; 42 | get scoreBoard(): ScoreBoard; 43 | update(): boolean; 44 | } 45 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/Player.d.ts: -------------------------------------------------------------------------------- 1 | import { PlayerInterface } from '../interfaces'; 2 | export declare class Player { 3 | private _id; 4 | private _name; 5 | private _avatar; 6 | constructor(id: number, name: string, avatar: string); 7 | get id(): number; 8 | get name(): string; 9 | get avatar(): string; 10 | getPlayerInterface(): PlayerInterface; 11 | } 12 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/Player.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Player = void 0; 4 | class Player { 5 | constructor(id, name, avatar) { 6 | this._id = id; 7 | this._name = name; 8 | this._avatar = avatar; 9 | } 10 | get id() { 11 | return this._id; 12 | } 13 | get name() { 14 | return this._name; 15 | } 16 | get avatar() { 17 | return this._avatar; 18 | } 19 | getPlayerInterface() { 20 | return { 21 | id: this._id, 22 | name: this._name, 23 | avatar: this.avatar, 24 | }; 25 | } 26 | } 27 | exports.Player = Player; 28 | //# sourceMappingURL=Player.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/Player.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Player.js","sourceRoot":"","sources":["../../../src/pong-game/utils/Player.ts"],"names":[],"mappings":";;;AAEA,MAAa,MAAM;IAKjB,YAAY,EAAU,EAAE,IAAY,EAAE,MAAc;QAClD,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAW,EAAE;QACX,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IACD,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,kBAAkB;QACvB,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,GAAG;YACZ,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;IACJ,CAAC;CACF;AA5BD,wBA4BC"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/ScoreBoard.d.ts: -------------------------------------------------------------------------------- 1 | import { ScoreBoardInterface } from '../interfaces'; 2 | export declare class ScoreBoard { 3 | private _playerOneScore; 4 | private _playerTwoScore; 5 | private _round; 6 | constructor(); 7 | get playerOneScore(): number; 8 | get playerTwoScore(): number; 9 | set playerOneScore(score: number); 10 | set playerTwoScore(score: number); 11 | get round(): number; 12 | PlayerOneScored(): void; 13 | PlayerTwoScored(): void; 14 | getScoreBoardInterface(): ScoreBoardInterface; 15 | reset(): void; 16 | } 17 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/ScoreBoard.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ScoreBoard = void 0; 4 | class ScoreBoard { 5 | constructor() { 6 | this.reset(); 7 | } 8 | get playerOneScore() { 9 | return this._playerOneScore; 10 | } 11 | get playerTwoScore() { 12 | return this._playerTwoScore; 13 | } 14 | set playerOneScore(score) { 15 | this._playerOneScore = score; 16 | } 17 | set playerTwoScore(score) { 18 | this._playerTwoScore = score; 19 | } 20 | get round() { 21 | return this._round; 22 | } 23 | PlayerOneScored() { 24 | this._playerOneScore++; 25 | this._round++; 26 | } 27 | PlayerTwoScored() { 28 | this._playerTwoScore++; 29 | this._round++; 30 | } 31 | getScoreBoardInterface() { 32 | return { 33 | playerOneScore: this._playerOneScore, 34 | playerTwoScore: this._playerTwoScore, 35 | round: this._round, 36 | }; 37 | } 38 | reset() { 39 | this._playerOneScore = 0; 40 | this._playerTwoScore = 0; 41 | this._round = 0; 42 | } 43 | } 44 | exports.ScoreBoard = ScoreBoard; 45 | //# sourceMappingURL=ScoreBoard.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/ScoreBoard.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ScoreBoard.js","sourceRoot":"","sources":["../../../src/pong-game/utils/ScoreBoard.ts"],"names":[],"mappings":";;;AAEA,MAAa,UAAU;IAKrB;QACE,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,IAAW,cAAc,CAAC,KAAa;QACrC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED,IAAW,cAAc,CAAC,KAAa;QACrC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAEM,eAAe;QACpB,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAEM,eAAe;QACpB,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAEM,sBAAsB;QAC3B,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,eAAe;YACpC,cAAc,EAAE,IAAI,CAAC,eAAe;YACpC,KAAK,EAAE,IAAI,CAAC,MAAM;SACnB,CAAC;IACJ,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;CACF;AApDD,gCAoDC"} -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './Paddle'; 2 | export * from './Ball'; 3 | export * from './PlayGround'; 4 | export * from './ScoreBoard'; 5 | export * from './Player'; 6 | -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 3 | if (k2 === undefined) k2 = k; 4 | var desc = Object.getOwnPropertyDescriptor(m, k); 5 | if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 6 | desc = { enumerable: true, get: function() { return m[k]; } }; 7 | } 8 | Object.defineProperty(o, k2, desc); 9 | }) : (function(o, m, k, k2) { 10 | if (k2 === undefined) k2 = k; 11 | o[k2] = m[k]; 12 | })); 13 | var __exportStar = (this && this.__exportStar) || function(m, exports) { 14 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 15 | }; 16 | Object.defineProperty(exports, "__esModule", { value: true }); 17 | __exportStar(require("./Paddle"), exports); 18 | __exportStar(require("./Ball"), exports); 19 | __exportStar(require("./PlayGround"), exports); 20 | __exportStar(require("./ScoreBoard"), exports); 21 | __exportStar(require("./Player"), exports); 22 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /src/backend/dist/pong-game/utils/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pong-game/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,yCAAuB;AACvB,+CAA6B;AAC7B,+CAA6B;AAC7B,2CAAyB"} -------------------------------------------------------------------------------- /src/backend/dist/relations/dto-relation/create-relation.dto.d.ts: -------------------------------------------------------------------------------- 1 | import { Player } from "../../players/player.entity"; 2 | export declare class CreateRelationDto { 3 | receiver: Player; 4 | } 5 | -------------------------------------------------------------------------------- /src/backend/dist/relations/dto-relation/create-relation.dto.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.CreateRelationDto = void 0; 13 | const class_validator_1 = require("class-validator"); 14 | const player_entity_1 = require("../../players/player.entity"); 15 | class CreateRelationDto { 16 | } 17 | __decorate([ 18 | (0, class_validator_1.IsNotEmpty)(), 19 | __metadata("design:type", player_entity_1.Player) 20 | ], CreateRelationDto.prototype, "receiver", void 0); 21 | exports.CreateRelationDto = CreateRelationDto; 22 | //# sourceMappingURL=create-relation.dto.js.map -------------------------------------------------------------------------------- /src/backend/dist/relations/dto-relation/create-relation.dto.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"create-relation.dto.js","sourceRoot":"","sources":["../../../src/relations/dto-relation/create-relation.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA6C;AAC7C,+DAAqD;AAErD,MAAa,iBAAiB;CAI7B;AADA;IADC,IAAA,4BAAU,GAAE;8BACH,sBAAM;mDAAC;AAHlB,8CAIC"} -------------------------------------------------------------------------------- /src/backend/dist/relations/dto-relation/get-relation-filter.dto.d.ts: -------------------------------------------------------------------------------- 1 | import { Player } from "../../players/player.entity"; 2 | import { RelationStatus } from "../relation_status.enum"; 3 | export declare class GetRelationFilterDto { 4 | id: number; 5 | status: RelationStatus; 6 | receiver: number; 7 | sender: Player; 8 | } 9 | -------------------------------------------------------------------------------- /src/backend/dist/relations/dto-relation/get-relation-filter.dto.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"get-relation-filter.dto.js","sourceRoot":"","sources":["../../../src/relations/dto-relation/get-relation-filter.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyE;AACzE,+DAAqD;AACrD,kEAAyD;AAEzD,MAAa,oBAAoB;CAmBhC;AAdA;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;gDACA;AAIX;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,sBAAI,EAAC,CAAC,qCAAc,CAAC,MAAM,EAAE,qCAAc,CAAC,OAAO,CAAC,CAAC;;oDAC/B;AAKvB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;sDACM;AAIjB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;8BACL,sBAAM;oDAAC;AAlBhB,oDAmBC"} -------------------------------------------------------------------------------- /src/backend/dist/relations/relation.entity.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseEntity } from "typeorm"; 2 | import { Player } from "../players/player.entity"; 3 | import { RelationStatus } from "./relation_status.enum"; 4 | export declare class Relation extends BaseEntity { 5 | id: number; 6 | status: RelationStatus; 7 | receiver: number; 8 | sender: Player; 9 | } 10 | -------------------------------------------------------------------------------- /src/backend/dist/relations/relation.entity.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.Relation = void 0; 13 | const typeorm_1 = require("typeorm"); 14 | const player_entity_1 = require("../players/player.entity"); 15 | const relation_status_enum_1 = require("./relation_status.enum"); 16 | let Relation = class Relation extends typeorm_1.BaseEntity { 17 | }; 18 | __decorate([ 19 | (0, typeorm_1.PrimaryGeneratedColumn)(), 20 | __metadata("design:type", Number) 21 | ], Relation.prototype, "id", void 0); 22 | __decorate([ 23 | (0, typeorm_1.Column)(), 24 | __metadata("design:type", String) 25 | ], Relation.prototype, "status", void 0); 26 | __decorate([ 27 | (0, typeorm_1.Column)(), 28 | __metadata("design:type", Number) 29 | ], Relation.prototype, "receiver", void 0); 30 | __decorate([ 31 | (0, typeorm_1.ManyToOne)(type => player_entity_1.Player, player => player.senders), 32 | __metadata("design:type", player_entity_1.Player) 33 | ], Relation.prototype, "sender", void 0); 34 | Relation = __decorate([ 35 | (0, typeorm_1.Entity)('relation') 36 | ], Relation); 37 | exports.Relation = Relation; 38 | //# sourceMappingURL=relation.entity.js.map -------------------------------------------------------------------------------- /src/backend/dist/relations/relation.entity.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"relation.entity.js","sourceRoot":"","sources":["../../src/relations/relation.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAwF;AACxF,4DAAkD;AAClD,iEAAwD;AAGxD,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,oBAAU;CAavC,CAAA;AAVG;IADC,IAAA,gCAAsB,GAAE;;oCACd;AAGX;IADC,IAAA,gBAAM,GAAE;;wCACc;AAGvB;IADC,IAAA,gBAAM,GAAE;;0CACQ;AAGjB;IADC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,sBAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;8BAC5C,sBAAM;wCAAC;AAZN,QAAQ;IADpB,IAAA,gBAAM,EAAC,UAAU,CAAC;GACN,QAAQ,CAapB;AAbY,4BAAQ"} -------------------------------------------------------------------------------- /src/backend/dist/relations/relation.repository.d.ts: -------------------------------------------------------------------------------- 1 | import { Repository } from "typeorm"; 2 | import { Player } from "../players/player.entity"; 3 | import { GetRelationFilterDto } from "./dto-relation/get-relation-filter.dto"; 4 | import { Relation } from "./relation.entity"; 5 | export declare class RelationRepository extends Repository { 6 | constructor(); 7 | getRelations(FilterDto: GetRelationFilterDto): Promise; 8 | addFriend(user: Player, friend: Player): Promise; 9 | blockPlayer(user: Player, blocked: Player): Promise; 10 | checkBlock(user: Player, blocked: Player): Promise; 11 | } 12 | -------------------------------------------------------------------------------- /src/backend/dist/relations/relation_status.enum.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum RelationStatus { 2 | FRIEND = "friend", 3 | BLOCKED = "blocked" 4 | } 5 | -------------------------------------------------------------------------------- /src/backend/dist/relations/relation_status.enum.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.RelationStatus = void 0; 4 | var RelationStatus; 5 | (function (RelationStatus) { 6 | RelationStatus["FRIEND"] = "friend"; 7 | RelationStatus["BLOCKED"] = "blocked"; 8 | })(RelationStatus = exports.RelationStatus || (exports.RelationStatus = {})); 9 | //# sourceMappingURL=relation_status.enum.js.map -------------------------------------------------------------------------------- /src/backend/dist/relations/relation_status.enum.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"relation_status.enum.js","sourceRoot":"","sources":["../../src/relations/relation_status.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;AACvB,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB"} -------------------------------------------------------------------------------- /src/backend/dist/relations/relations.controller.d.ts: -------------------------------------------------------------------------------- 1 | import { Relation } from "./relation.entity"; 2 | import { RelationsService } from "./relations.service"; 3 | import { Request } from "express"; 4 | import { UsersService } from "../players/players.service"; 5 | export declare class RelationsController { 6 | private readonly relationService; 7 | private readonly usersService; 8 | constructor(relationService: RelationsService, usersService: UsersService); 9 | addFriend(req: Request, friend_id: number): Promise; 10 | blockPlayer(req: Request, blocked_id: number): Promise; 11 | unblock(req: Request, unblock_id: number): Promise; 12 | removeFriend(req: Request, unfollow_id: number): Promise; 13 | } 14 | -------------------------------------------------------------------------------- /src/backend/dist/relations/relations.controller.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"relations.controller.js","sourceRoot":"","sources":["../../src/relations/relations.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8G;AAI9G,2DAAuD;AAGvD,gEAA0D;AAI1D,IAAa,mBAAmB,GAAhC,MAAa,mBAAmB;IAC/B,YACkB,eAAiC,EACjC,YAA0B;QAD1B,oBAAe,GAAf,eAAe,CAAkB;QACjC,iBAAY,GAAZ,YAAY,CAAc;IACzC,CAAC;IAIJ,KAAK,CAAC,SAAS,CACP,GAAY,EAEQ,SAAiB;QAE5C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;IAID,KAAK,CAAC,WAAW,CACT,GAAY,EACQ,UAAkB;QAE7C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC;IAGD,KAAK,CAAC,OAAO,CACL,GAAY,EACQ,UAAkB;QAE7C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;IAGD,KAAK,CAAC,YAAY,CACV,GAAY,EACQ,WAAmB;QAE9C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC7D,CAAC;CAED,CAAA;AArCA;IAFC,IAAA,aAAI,EAAC,SAAS,CAAC;IACf,IAAA,iBAAQ,EAAC,uBAAc,CAAC;IAEvB,WAAA,IAAA,YAAG,GAAE,CAAA;IAEL,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;;;;oDAI1B;AAID;IAFC,IAAA,aAAI,EAAC,WAAW,CAAC;IACjB,IAAA,iBAAQ,EAAC,uBAAc,CAAC;IAEvB,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;;;;sDAI1B;AAGD;IADC,IAAA,eAAM,EAAC,aAAa,CAAC;IAEpB,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;;;;kDAI1B;AAGD;IADC,IAAA,eAAM,EAAC,cAAc,CAAC;IAErB,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;;;;uDAI1B;AA3CW,mBAAmB;IAD/B,IAAA,mBAAU,EAAC,WAAW,CAAC;qCAGY,oCAAgB;QACnB,8BAAY;GAHhC,mBAAmB,CA6C/B;AA7CY,kDAAmB"} -------------------------------------------------------------------------------- /src/backend/dist/relations/relations.module.d.ts: -------------------------------------------------------------------------------- 1 | export declare class RelationModule { 2 | } 3 | -------------------------------------------------------------------------------- /src/backend/dist/relations/relations.module.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | Object.defineProperty(exports, "__esModule", { value: true }); 9 | exports.RelationModule = void 0; 10 | const common_1 = require("@nestjs/common"); 11 | const jwt_1 = require("@nestjs/jwt"); 12 | const passport_1 = require("@nestjs/passport"); 13 | const typeorm_1 = require("@nestjs/typeorm"); 14 | const player_repository_1 = require("../players/player.repository"); 15 | const players_service_1 = require("../players/players.service"); 16 | const relation_repository_1 = require("./relation.repository"); 17 | const relations_controller_1 = require("./relations.controller"); 18 | const relations_service_1 = require("./relations.service"); 19 | let RelationModule = class RelationModule { 20 | }; 21 | RelationModule = __decorate([ 22 | (0, common_1.Module)({ 23 | imports: [ 24 | passport_1.PassportModule.register({ defaultStrategy: 'jwt' }), 25 | jwt_1.JwtModule.register({ 26 | secret: 'pingpong', 27 | signOptions: { 28 | expiresIn: 3600, 29 | }, 30 | }), 31 | typeorm_1.TypeOrmModule.forFeature([relation_repository_1.RelationRepository]), 32 | typeorm_1.TypeOrmModule.forFeature([player_repository_1.PlayerRepository]), 33 | ], 34 | controllers: [relations_controller_1.RelationsController], 35 | providers: [ 36 | relations_service_1.RelationsService, 37 | players_service_1.UsersService, 38 | ], 39 | exports: [relations_service_1.RelationsService], 40 | }) 41 | ], RelationModule); 42 | exports.RelationModule = RelationModule; 43 | //# sourceMappingURL=relations.module.js.map -------------------------------------------------------------------------------- /src/backend/dist/relations/relations.module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"relations.module.js","sourceRoot":"","sources":["../../src/relations/relations.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qCAAwC;AACxC,+CAAkD;AAClD,6CAAgD;AAChD,oEAAgE;AAEhE,gEAA0D;AAC1D,+DAA2D;AAC3D,iEAA6D;AAC7D,2DAAuD;AAsBvD,IAAa,cAAc,GAA3B,MAAa,cAAc;CAAG,CAAA;AAAjB,cAAc;IApB1B,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE;YACL,yBAAc,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;YACnD,eAAS,CAAC,QAAQ,CAAC;gBACf,MAAM,EAAE,UAAU;gBAClB,WAAW,EAAE;oBAET,SAAS,EAAE,IAAI;iBAClB;aACJ,CAAC;YACF,uBAAa,CAAC,UAAU,CAAC,CAAC,wCAAkB,CAAC,CAAC;YAC9C,uBAAa,CAAC,UAAU,CAAC,CAAC,oCAAgB,CAAC,CAAC;SAC/C;QACD,WAAW,EAAE,CAAC,0CAAmB,CAAC;QAClC,SAAS,EAAE;YACP,oCAAgB;YAChB,8BAAY;SACf;QACD,OAAO,EAAE,CAAC,oCAAgB,CAAC;KAC9B,CAAC;GACW,cAAc,CAAG;AAAjB,wCAAc"} -------------------------------------------------------------------------------- /src/backend/dist/relations/relations.service.d.ts: -------------------------------------------------------------------------------- 1 | import { Player } from "../players/player.entity"; 2 | import { UsersService } from "../players/players.service"; 3 | import { GetRelationFilterDto } from "./dto-relation/get-relation-filter.dto"; 4 | import { Relation } from "./relation.entity"; 5 | import { RelationRepository } from "./relation.repository"; 6 | import { RelationStatus } from "./relation_status.enum"; 7 | export declare class RelationsService { 8 | private relationRepository; 9 | private readonly usersService; 10 | constructor(relationRepository: RelationRepository, usersService: UsersService); 11 | getRelations(FilterDto: GetRelationFilterDto): Promise; 12 | getUsersByStatus(user: Player, status: RelationStatus): Promise; 13 | addFriend(user: Player, friend_id: number): Promise; 14 | blockPlayer(user: Player, blocked_id: number): Promise; 15 | unblock(user: Player, blocked_id: number): Promise; 16 | removeFriend(user: Player, friend_id: number): Promise; 17 | checkBlock(user_id: number, blocked_id: number): Promise; 18 | } 19 | -------------------------------------------------------------------------------- /src/backend/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/nest-cli", 3 | "collection": "@nestjs/schematics", 4 | "sourceRoot": "src" 5 | } 6 | -------------------------------------------------------------------------------- /src/backend/npmList_packages: -------------------------------------------------------------------------------- 1 | ttest@0.0.1 /Users/iidzim/Desktop/ft_transcendence/backend 2 | ├── @dicebear/avatars@4.10.2 3 | ├── @dicebear/croodles@4.10.2 4 | ├── @nestjs/cli@8.2.6 5 | ├── @nestjs/common@8.4.5 6 | ├── @nestjs/config@2.1.0 7 | ├── @nestjs/core@8.4.5 8 | ├── @nestjs/jwt@8.0.1 9 | ├── @nestjs/passport@8.2.1 10 | ├── @nestjs/platform-express@8.4.5 11 | ├── @nestjs/platform-socket.io@8.4.7 12 | ├── @nestjs/schematics@8.0.11 13 | ├── @nestjs/serve-static@3.0.0 14 | ├── @nestjs/swagger@5.2.1 15 | ├── @nestjs/testing@8.4.5 16 | ├── @nestjs/typeorm@8.0.4 17 | ├── @nestjs/websockets@8.4.7 18 | ├── @types/cookie-parser@1.4.3 19 | ├── @types/express@4.17.13 20 | ├── @types/jest@27.5.0 21 | ├── @types/multer@1.4.7 22 | ├── @types/node@16.11.36 23 | ├── @types/supertest@2.0.12 24 | ├── @typescript-eslint/eslint-plugin@5.25.0 25 | ├── @typescript-eslint/parser@5.25.0 26 | ├── bcrypt@5.0.1 27 | ├── class-transformer@0.5.1 28 | ├── class-validator@0.13.2 29 | ├── cookie-parser@1.4.6 30 | ├── dotenv@16.0.1 31 | ├── eslint-config-prettier@8.5.0 32 | ├── eslint-plugin-prettier@4.0.0 33 | ├── eslint@8.16.0 34 | ├── express-passport-logout@0.1.0 35 | ├── jest@28.0.3 36 | ├── mysql2@2.3.3 37 | ├── otplib@12.0.1 38 | ├── passport-42@1.2.6 39 | ├── passport-http@0.3.0 40 | ├── passport-jwt@4.0.0 41 | ├── passport@0.5.3 42 | ├── pg@8.7.3 43 | ├── prettier@2.6.2 44 | ├── qrcode@1.5.1 45 | ├── reflect-metadata@0.1.13 46 | ├── rimraf@3.0.2 47 | ├── rxjs@7.5.5 48 | ├── source-map-support@0.5.21 49 | ├── supertest@6.2.3 50 | ├── swagger-ui-express@4.4.0 51 | ├── ts-jest@28.0.1 52 | ├── ts-loader@9.3.0 53 | ├── ts-node@10.8.0 54 | ├── tsconfig-paths@4.0.0 55 | ├── typeorm@0.2.45 56 | └── typescript@4.6.4 57 | 58 | -------------------------------------------------------------------------------- /src/backend/package_installed.txt: -------------------------------------------------------------------------------- 1 | npm install -g @nestjs/cli 2 | # Install TypeScript globally if it isn't already installed. 3 | npm install -g typescript 4 | npm install typeorm --save 5 | npm install pg --save 6 | npm install class-validator class-transformer --save 7 | 8 | npm install --save @dicebear/avatars @dicebear/croodles 9 | npm install bcrypt --save 10 | npm install --save @types/express 11 | npm install dotenv --save 12 | npm install --save @nestjs/passport passport passport-42 13 | npm i cookie-parser 14 | npm i --save @types/cookie-parser 15 | 16 | https://github.com/arielweinberger/nestjs-course-task-management/tree/validation/task-filtering-and-search -------------------------------------------------------------------------------- /src/backend/public/aait-hmi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/backend/public/aait-hmi.jpg -------------------------------------------------------------------------------- /src/backend/public/aait-hmi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/backend/public/aait-hmi.png -------------------------------------------------------------------------------- /src/backend/public/mlachheb.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/backend/public/mlachheb.jpeg -------------------------------------------------------------------------------- /src/backend/public/mlachheb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/backend/public/mlachheb.png -------------------------------------------------------------------------------- /src/backend/public/oumeimatt.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/backend/public/oumeimatt.jpeg -------------------------------------------------------------------------------- /src/backend/public/qr_62530.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/backend/public/qr_62530.png -------------------------------------------------------------------------------- /src/backend/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; 2 | import { ConfigModule } from '@nestjs/config'; 3 | import { TypeOrmModule } from '@nestjs/typeorm'; 4 | import { typeOrmConfig } from './config/typeorm.config'; 5 | import { AuthModule } from './auth/auth.module'; 6 | import { PlayerModule } from './players/players.module'; 7 | import { RelationModule } from './relations/relations.module'; 8 | import { PongGameModule } from './pong-game/pong-game.module'; 9 | import { ChatModule } from './chat/chat.module'; 10 | import { ServeStaticModule } from '@nestjs/serve-static'; 11 | import { join } from 'path'; 12 | import { LoggerMiddleware } from './config/logger.middleware'; 13 | import { AppGateway } from './players/app.gateway'; 14 | 15 | @Module({ 16 | imports: [ 17 | ServeStaticModule.forRoot({ 18 | rootPath: join(__dirname, '..', 'public'), 19 | }), 20 | ConfigModule.forRoot({ envFilePath: '.env' }), 21 | TypeOrmModule.forRoot(typeOrmConfig), 22 | AuthModule, 23 | PlayerModule, 24 | RelationModule, 25 | PongGameModule, 26 | ChatModule, 27 | ], 28 | controllers: [], 29 | providers: [], 30 | }) 31 | export class AppModule {} 32 | // export class AppModule implements NestModule{ 33 | // constructor() {} 34 | // configure(consumer: MiddlewareConsumer) { 35 | // consumer.apply(LoggerMiddleware).forRoutes('*'); 36 | // } 37 | // } -------------------------------------------------------------------------------- /src/backend/src/auth/auth-exception.filter.ts: -------------------------------------------------------------------------------- 1 | import { ArgumentsHost, Catch, ExceptionFilter, HttpException } from "@nestjs/common"; 2 | import { Request, Response } from 'express'; 3 | 4 | @Catch(HttpException) 5 | export class AuthExceptionFilter implements ExceptionFilter { 6 | 7 | catch(exception: any, host: ArgumentsHost) { 8 | const ctx = host.switchToHttp(); 9 | const response = ctx.getResponse(); 10 | const request = ctx.getRequest(); 11 | const status = exception.getStatus(); 12 | const message = exception.message; 13 | if (status === 401) 14 | response.redirect('http://' + process.env.FRONTEND_HOST +'/home'); 15 | else { 16 | response.status(status).json({ 17 | statusCode: status, 18 | message: message, 19 | timestamp: new Date().toISOString(), 20 | path: request.url, 21 | }); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/backend/src/auth/auth.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, UseGuards, Req, Res, Response, UseInterceptors, UseFilters } from '@nestjs/common'; 2 | import { AuthService } from './auth.service'; 3 | import { Request } from "express"; 4 | import { AuthGuard } from '@nestjs/passport'; 5 | import { UsersService } from '../players/players.service'; 6 | import { AuthExceptionFilter } from './auth-exception.filter'; 7 | 8 | @Controller('/auth') 9 | export class AuthController { 10 | constructor( 11 | private readonly authService: AuthService, 12 | private readonly usersService: UsersService, 13 | ) {} 14 | 15 | @Get('/login') 16 | @UseFilters(new AuthExceptionFilter()) 17 | @UseGuards(AuthGuard('42')) 18 | async FortyTwoAuth( 19 | @Req() req: Request, 20 | @Response() res, 21 | ): Promise { 22 | this.authService.login(req, res); 23 | } 24 | 25 | @Get('/logout') 26 | async logout( 27 | @Req() req: Request, 28 | @Res() res: Response, 29 | ): Promise { 30 | // console.log('logout -> verify'); 31 | const user = await this.usersService.verifyToken(req.cookies.connect_sid); 32 | return this.authService.logout(user.id, res); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/backend/src/auth/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { JwtModule } from '@nestjs/jwt'; 3 | import { PassportModule } from '@nestjs/passport'; 4 | import { TypeOrmModule } from '@nestjs/typeorm'; 5 | import { PlayerRepository } from '../players/player.repository'; 6 | import { PlayerModule } from '../players/players.module'; 7 | import { UsersService } from '../players/players.service'; 8 | import { AuthController } from './auth.controller'; 9 | import { AuthService } from './auth.service'; 10 | 11 | @Module({ 12 | imports: [ 13 | PassportModule.register({ defaultStrategy: 'jwt' }), 14 | JwtModule.register({ 15 | secret: 'pingpong', 16 | signOptions: { 17 | expiresIn: '1d', 18 | }, 19 | }), 20 | TypeOrmModule.forFeature([PlayerRepository]), 21 | PlayerModule, 22 | ], 23 | controllers: [AuthController], 24 | providers: [ 25 | AuthService, 26 | UsersService, 27 | ], 28 | exports: [AuthService, UsersService] 29 | }) 30 | export class AuthModule {} 31 | -------------------------------------------------------------------------------- /src/backend/src/auth/jwt-payload.interface.ts: -------------------------------------------------------------------------------- 1 | export interface JwtPayload { 2 | username: string; 3 | id: number; 4 | two_fa: boolean; 5 | } -------------------------------------------------------------------------------- /src/backend/src/auth/jwt.strategy.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, UnauthorizedException } from "@nestjs/common"; 2 | import { PassportStrategy } from "@nestjs/passport"; 3 | import { InjectRepository } from "@nestjs/typeorm"; 4 | import { Strategy, ExtractJwt } from 'passport-jwt'; 5 | import { JwtPayload } from "./jwt-payload.interface"; 6 | import { PlayerRepository } from "../players/player.repository"; 7 | import { Player } from "../players/player.entity"; 8 | 9 | @Injectable() 10 | export class JwtStrategy extends PassportStrategy(Strategy) { 11 | constructor( 12 | @InjectRepository(PlayerRepository) 13 | private playerRepository: PlayerRepository, 14 | ) { 15 | super({ 16 | jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), 17 | secretOrKey: 'pingpong', 18 | }); 19 | } 20 | 21 | async validate(payload: JwtPayload): Promise { 22 | const { username } = payload; 23 | const user = await this.playerRepository.findOne({username}); 24 | if (!user) { 25 | throw new UnauthorizedException(); 26 | } 27 | return user; 28 | } 29 | } -------------------------------------------------------------------------------- /src/backend/src/chat/chat.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { TypeOrmModule } from '@nestjs/typeorm'; 3 | 4 | import { ChatGateway } from './chat.gateway'; 5 | import { roomRepository } from './room.repository'; 6 | import { ChatService } from './chat.service'; 7 | import { AuthModule } from 'src/auth/auth.module'; 8 | import { AuthService } from 'src/auth/auth.service'; 9 | import { JwtService } from '@nestjs/jwt'; 10 | import { JwtStrategy } from 'src/auth/jwt.strategy'; 11 | import { ChatController } from './chat.controller'; 12 | import { membership } from './membership.entity'; 13 | import { message } from './message.entity'; 14 | import { PlayerRepository } from 'src/players/player.repository'; 15 | import { RelationModule } from 'src/relations/relations.module'; 16 | 17 | 18 | @Module({ 19 | imports:[AuthModule,RelationModule , TypeOrmModule.forFeature([roomRepository, PlayerRepository, membership, message]),], 20 | providers: [ChatGateway, ChatService], 21 | controllers: [ChatController], //ChatService, RoomService, JwtStrategy, AuthService], 22 | }) 23 | 24 | export class ChatModule {} -------------------------------------------------------------------------------- /src/backend/src/chat/chat.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { ChatService } from './chat.service'; 3 | 4 | describe('ChatService', () => { 5 | let service: ChatService; 6 | 7 | beforeEach(async () => { 8 | const module: TestingModule = await Test.createTestingModule({ 9 | providers: [ChatService], 10 | }).compile(); 11 | 12 | service = module.get(ChatService); 13 | }); 14 | 15 | it('should be defined', () => { 16 | expect(service).toBeDefined(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /src/backend/src/chat/dto/join-channel-dto.ts: -------------------------------------------------------------------------------- 1 | export class JoinChannelDto{ 2 | roomid:number; 3 | password:string; 4 | } -------------------------------------------------------------------------------- /src/backend/src/chat/dto/member-dto.ts: -------------------------------------------------------------------------------- 1 | import { Player } from "src/players/player.entity"; 2 | import { RoleStatus } from "./membership.model"; 3 | 4 | export class memberDto{ 5 | member:Player; 6 | role:RoleStatus; 7 | isbanned:boolean; 8 | ismuted:boolean; 9 | } -------------------------------------------------------------------------------- /src/backend/src/chat/dto/membership-dto.ts: -------------------------------------------------------------------------------- 1 | export class membershipDto{ 2 | userid:number; 3 | roomid:number; 4 | } -------------------------------------------------------------------------------- /src/backend/src/chat/dto/membership.model.ts: -------------------------------------------------------------------------------- 1 | export interface Membership{ 2 | id:number; 3 | role:RoleStatus; 4 | 5 | } 6 | 7 | export enum RoleStatus{ 8 | ADMIN = 'ADMIN', 9 | OWNER = 'OWNER', 10 | USER = 'USER', 11 | } -------------------------------------------------------------------------------- /src/backend/src/chat/dto/message-dto.ts: -------------------------------------------------------------------------------- 1 | export class messageDto{ 2 | id:number; 3 | content:string; 4 | } -------------------------------------------------------------------------------- /src/backend/src/chat/dto/mute-dto.ts: -------------------------------------------------------------------------------- 1 | export class muteDto{ 2 | roomid:number; 3 | userid:number; 4 | 5 | duration:number; 6 | } -------------------------------------------------------------------------------- /src/backend/src/chat/dto/room-dto.ts: -------------------------------------------------------------------------------- 1 | import { IsNotEmpty, IsOptional } from "class-validator"; 2 | 3 | 4 | export class RoomDto{ 5 | 6 | // @IsNotEmpty() 7 | // id:number; 8 | name:string; 9 | 10 | // isChannel:boolean; 11 | // isPublic:boolean; 12 | privacy:string; 13 | password:string; 14 | 15 | players:any[]; 16 | created_at:Date; 17 | updated_at:Date; 18 | 19 | 20 | 21 | // @IsNotEmpty() 22 | // isChannel:boolean; 23 | 24 | // // @IsNotEmpty() 25 | // isPublic:boolean; 26 | 27 | // // @IsOptional() 28 | // password:string; 29 | } -------------------------------------------------------------------------------- /src/backend/src/chat/membership.entity.ts: -------------------------------------------------------------------------------- 1 | 2 | import { Player } from "src/players/player.entity"; 3 | import { BaseEntity, Column, Entity, PrimaryGeneratedColumn,ManyToOne, ManyToMany, CreateDateColumn, UpdateDateColumn, JoinTable, JoinColumn} from "typeorm"; 4 | import { RoleStatus } from "./dto/membership.model"; 5 | import { chatroom } from "./room.entity"; 6 | 7 | @Entity() 8 | export class membership extends BaseEntity{ 9 | 10 | @PrimaryGeneratedColumn() 11 | id_membership:number; 12 | 13 | @Column() 14 | role:RoleStatus; 15 | 16 | @Column() 17 | isbanned:boolean; 18 | 19 | @Column() 20 | ismuted:boolean; 21 | 22 | @Column({ name: 'playerid' }) 23 | playerid: number; 24 | 25 | @ManyToOne(()=> Player, Player=>Player.memberships) 26 | @JoinColumn({ name: "playerid" }) 27 | Player: Player; 28 | 29 | @Column({ name: 'roomid' }) 30 | roomid: number; 31 | 32 | @ManyToOne(()=> chatroom, room=>room.memberships) 33 | @JoinColumn({ name:"roomid"}) 34 | room:chatroom; 35 | } -------------------------------------------------------------------------------- /src/backend/src/chat/message.entity.ts: -------------------------------------------------------------------------------- 1 | 2 | import { Player } from "src/players/player.entity"; 3 | import { BaseEntity, Column, Entity,OneToMany, PrimaryGeneratedColumn, ManyToOne,JoinColumn, CreateDateColumn, UpdateDateColumn, JoinTable} from "typeorm"; 4 | import { chatroom } from "./room.entity"; 5 | 6 | @Entity() 7 | export class message extends BaseEntity{ 8 | @PrimaryGeneratedColumn() 9 | id:number; 10 | 11 | @Column() 12 | content:string; 13 | 14 | @CreateDateColumn() 15 | created_at:Date; 16 | 17 | @Column({ name: 'playerid' }) 18 | playerid: number; 19 | 20 | @Column({ name: 'roomid' }) 21 | roomid: number; 22 | 23 | @ManyToOne(()=> chatroom, room=> room.messages) 24 | @JoinColumn({name:"roomid"}) 25 | room:chatroom; 26 | 27 | @ManyToOne(()=> Player, player=>player.messages) 28 | @JoinColumn({name:"playerid"}) 29 | Player:Player; 30 | } -------------------------------------------------------------------------------- /src/backend/src/chat/room.entity.ts: -------------------------------------------------------------------------------- 1 | 2 | import { BaseEntity, Column, Entity,OneToMany, PrimaryGeneratedColumn, ManyToMany, CreateDateColumn, UpdateDateColumn, JoinTable} from "typeorm"; 3 | import { message } from "./message.entity"; 4 | import { membership } from "./membership.entity"; 5 | 6 | @Entity() 7 | export class chatroom extends BaseEntity{ 8 | 9 | @PrimaryGeneratedColumn() 10 | id:number; 11 | 12 | @Column({unique:true}) 13 | name:string; 14 | 15 | @Column({default:true}) 16 | ischannel:boolean; 17 | 18 | @Column({default:true}) 19 | ispublic:boolean; 20 | 21 | @Column()//{select:false} 22 | password:string; 23 | 24 | @Column() 25 | salt:string; 26 | 27 | // @ManyToMany(()=>player) 28 | // @JoinTable() 29 | // players:player[]; 30 | @OneToMany(()=>membership, membership=>membership.room) 31 | memberships:membership[]; 32 | 33 | @OneToMany(()=>message, message=>message.room) 34 | messages:message[]; 35 | 36 | @CreateDateColumn() 37 | create_at:Date; 38 | 39 | @UpdateDateColumn() 40 | updated_at:Date; 41 | 42 | } -------------------------------------------------------------------------------- /src/backend/src/config/logger.middleware.ts: -------------------------------------------------------------------------------- 1 | import { NestMiddleware} from "@nestjs/common"; 2 | import { NextFunction, Request, Response } from "express"; 3 | import { UsersService } from "../players/players.service"; 4 | import { UserStatus } from "../players/player_status.enum"; 5 | // import { Player } from "../players/player.entity"; 6 | 7 | export class LoggerMiddleware implements NestMiddleware { 8 | constructor( 9 | private readonly usersService: UsersService, 10 | ) {} 11 | async use(req: Request, res: Response, next: NextFunction) { 12 | // console.log("middleware **** "); 13 | // console.log(req.body); 14 | // console.log(`${req.method} ${req.url}`); 15 | // console.log(req.cookies.connect_sid); 16 | // const user = await this.usersService.verifyToken(req.cookies.connect_sid); 17 | // for (const [i, j] of Object.entries(user)) { 18 | // console.log(i, j); 19 | // } 20 | // const player = await this.usersService.getUserByStatusId(user.id); 21 | // if (player) { 22 | // await this.usersService.updateStatus(user.id, UserStatus.ONLINE); 23 | // console.log(`${player.username} is offline`); 24 | // } 25 | next(); 26 | } 27 | } -------------------------------------------------------------------------------- /src/backend/src/config/typeorm.config.ts: -------------------------------------------------------------------------------- 1 | import { TypeOrmModuleOptions } from "@nestjs/typeorm"; 2 | import { message } from "src/chat/message.entity"; 3 | import { membership } from "src/chat/membership.entity"; 4 | import { chatroom } from "src/chat/room.entity"; 5 | import { Player } from "../players/player.entity"; 6 | import { Relation } from "../relations/relation.entity"; 7 | import { GameRoom } from "src/pong-game/typeorm/game-room.entity"; 8 | import { GameHistory } from "src/pong-game/typeorm/game-history.entity"; 9 | 10 | export const typeOrmConfig: TypeOrmModuleOptions = { 11 | type: 'postgres', 12 | host: '127.0.0.1', 13 | // host: '10.11.1.2', 14 | port: 5432, 15 | username: 'ping', 16 | password: 'pong', 17 | database: 'pong_db', 18 | entities: [ 19 | Player, 20 | Relation, 21 | chatroom, 22 | membership, 23 | message, 24 | GameRoom, 25 | GameHistory 26 | ], 27 | synchronize: true, 28 | logging: false, 29 | autoLoadEntities : true, 30 | } 31 | -------------------------------------------------------------------------------- /src/backend/src/main.ts: -------------------------------------------------------------------------------- 1 | import { NestFactory } from '@nestjs/core'; 2 | import { AppModule } from './app.module'; 3 | import * as cookieParser from 'cookie-parser'; 4 | //import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; 5 | 6 | async function bootstrap() { 7 | const app = await NestFactory.create(AppModule); 8 | 9 | 10 | // const config = new DocumentBuilder() 11 | // .setTitle('NestJS API') 12 | // .setDescription('The NestJS API description') 13 | // .setVersion('1.0') 14 | // .addTag('api') 15 | // .build(); 16 | 17 | // const document = SwaggerModule.createDocument(app, config); 18 | // SwaggerModule.setup('api', app, document); 19 | 20 | app.use(cookieParser()); 21 | app.enableCors({origin: "http://" + process.env.FRONTEND_HOST, credentials: true}); // edited 22 | // app.enableCors({ 23 | // origin: ["http://" + process.env.FRONTEND_HOST, "https://api.intra.42.fr/"], 24 | // methods: ['GET', 'POST', 'DELETE', 'OPTIONS', 'HEAD'], 25 | // credentials: true 26 | // }); 27 | await app.listen(3001); 28 | } 29 | bootstrap(); 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | // td list: 38 | 39 | //+ catch expired token exception 40 | //+ users status depending on connectedUsers table 41 | 42 | 43 | //! errors 44 | //[Nest] 6028 - 07/26/2022, 9:45:29 PM ERROR [ExceptionsHandler] ENOENT: no such file or directory, stat '/Users/iidzim/Desktop/ft_transcendence/backend/public/index.html' 45 | 46 | 47 | 48 | // website: http://10.11.11.1 49 | // redirect uri: http://10.11.11.1:3001/auth/login 50 | -------------------------------------------------------------------------------- /src/backend/src/players/app.gateway.ts: -------------------------------------------------------------------------------- 1 | import { Logger } from '@nestjs/common'; 2 | import { 3 | OnGatewayConnection, 4 | OnGatewayDisconnect, 5 | WebSocketGateway, 6 | WebSocketServer 7 | } from '@nestjs/websockets'; 8 | import { Server } from 'http'; 9 | import { Socket } from 'socket.io'; 10 | import { UsersService } from './players.service'; 11 | 12 | @WebSocketGateway({ namespace: '/connect', cors: true, path: '/user/connected' }) 13 | export class AppGateway implements OnGatewayConnection, OnGatewayDisconnect { 14 | 15 | private connectedUsers: { playerId: number, clientId: string }[]; 16 | @WebSocketServer() server: Server; 17 | private logger: Logger = new Logger('Connect Gateway'); 18 | constructor(private usersService: UsersService) { 19 | this.connectedUsers = []; 20 | } 21 | 22 | //& called whenever client connects to the server 23 | async handleConnection(client: any) { 24 | if (client.handshake.query.accessToken != 'null') { 25 | try { 26 | const user = await this.usersService.verifyToken(client.handshake.query.accessToken as string); 27 | // console.log('handle connection -> verify'); 28 | const found = await this.usersService.findPlayer(user.id); 29 | if (found) { 30 | this.connectedUsers.push({ playerId: found.id , clientId: client.id }); 31 | this.server.emit('connected', { connectedUsers: this.connectedUsers }); 32 | } 33 | } catch(err) { 34 | this.logger.error(err); 35 | } 36 | } 37 | } 38 | 39 | handleDisconnect(client: Socket, ...args: any[]) { 40 | const user = this.connectedUsers.find(us => us.clientId === client.id); 41 | // console.log('handle disconnect ' + user.playerId + ' - ' + user.clientId); 42 | this.connectedUsers = this.connectedUsers.filter(us => us.clientId !== client.id); 43 | this.server.emit('disconnected', { connectedUsers: this.connectedUsers }); 44 | } 45 | } -------------------------------------------------------------------------------- /src/backend/src/players/dto-players/create-player.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsAlphanumeric, IsNotEmpty, IsOptional, IsString, Matches, MaxLength, MinLength } from "class-validator"; 2 | 3 | export class CreateUserDto { 4 | 5 | @IsNotEmpty() 6 | @IsString() 7 | @MaxLength(50) 8 | @IsAlphanumeric() 9 | username: string; 10 | 11 | @IsOptional() 12 | @IsString() 13 | @MaxLength(100) 14 | avatar: string; 15 | 16 | // @IsNotEmpty() 17 | // @IsString() 18 | // @MinLength(8) 19 | // @MaxLength(20) 20 | // @Matches( 21 | // /((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/, 22 | // { message: 'password too weak' }, 23 | // ) 24 | // password: string; 25 | } 26 | 27 | // Passwords will contain at least 1 upper case letter 28 | // Passwords will contain at least 1 lower case letter 29 | // Passwords will contain at least 1 number or special character 30 | // There is no length validation (min, max) in this regex! -------------------------------------------------------------------------------- /src/backend/src/players/dto-players/get-player-filter.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsIn, IsNotEmpty, IsNumber, IsOptional, IsString } from "class-validator"; 2 | import { UserStatus } from "../player_status.enum"; 3 | 4 | export class GetPlayersFilterDto { 5 | 6 | @IsOptional() 7 | @IsNotEmpty() 8 | @IsNumber() 9 | id: number; 10 | 11 | @IsOptional() 12 | @IsString() 13 | username: string; 14 | 15 | @IsOptional() 16 | @IsNotEmpty() 17 | @IsNumber() 18 | level: number; 19 | 20 | @IsOptional() 21 | @IsIn([UserStatus.OFFLINE, UserStatus.ONLINE, UserStatus.PLAYING]) 22 | status: UserStatus; 23 | } -------------------------------------------------------------------------------- /src/backend/src/players/player.entity.ts: -------------------------------------------------------------------------------- 1 | import { BaseEntity, Column, Entity, OneToMany, PrimaryColumn, Unique, UpdateDateColumn } from "typeorm"; 2 | import { UserStatus } from "./player_status.enum"; 3 | import { Relation } from "../relations/relation.entity"; 4 | import { membership } from "src/chat/membership.entity"; 5 | import { message } from "src/chat/message.entity"; 6 | import { GameHistory } from "src/pong-game/typeorm/game-history.entity"; 7 | 8 | @Entity('player') 9 | @Unique(['username']) 10 | export class Player extends BaseEntity { 11 | 12 | @PrimaryColumn() 13 | id: number; 14 | 15 | @Column() 16 | username: string; 17 | 18 | @Column() 19 | avatar: string; 20 | 21 | @Column({type: 'real'}) 22 | level: number; 23 | 24 | @Column() 25 | wins: number; 26 | 27 | @Column() 28 | losses: number; 29 | 30 | @Column({ default: UserStatus.OFFLINE }) 31 | status: UserStatus; 32 | 33 | @Column({ default: true }) 34 | first_time: boolean; 35 | 36 | @Column({ default: false }) 37 | two_fa: boolean; 38 | 39 | @Column({ nullable: true }) 40 | secret: string; 41 | 42 | @OneToMany( 43 | type => Relation, 44 | relation => relation.sender, 45 | {eager: true} 46 | ) 47 | senders: Relation[]; 48 | 49 | @OneToMany( 50 | ()=> membership, 51 | membership=>membership.Player 52 | ) 53 | memberships : membership[]; 54 | 55 | @OneToMany( 56 | ()=>message, 57 | message=> message.Player 58 | ) 59 | messages:message[]; 60 | 61 | @OneToMany( 62 | () => GameHistory, 63 | gameHistory => gameHistory.winner || gameHistory.winner 64 | ) 65 | gameHistory: GameHistory; 66 | } -------------------------------------------------------------------------------- /src/backend/src/players/player_status.enum.ts: -------------------------------------------------------------------------------- 1 | export enum UserStatus { 2 | ONLINE = 'online', 3 | TWOFA = 'twofa', 4 | OFFLINE = 'offline', 5 | PLAYING = 'playing', 6 | } -------------------------------------------------------------------------------- /src/backend/src/players/players.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { TypeOrmModule } from '@nestjs/typeorm'; 3 | import { JwtModule } from '@nestjs/jwt'; 4 | import { PassportModule } from '@nestjs/passport'; 5 | import { UsersController } from "./players.controller"; 6 | import { UsersService } from "./players.service"; 7 | import { PlayerRepository } from './player.repository'; 8 | import { RelationModule } from '../relations/relations.module'; 9 | import { JwtStrategy } from '../auth/jwt.strategy'; 10 | import { RelationRepository } from '../relations/relation.repository'; 11 | import { membership } from 'src/chat/membership.entity'; 12 | import { roomRepository } from 'src/chat/room.repository'; 13 | import { AppGateway } from './app.gateway'; 14 | 15 | @Module({ 16 | imports: [ 17 | PassportModule.register({ defaultStrategy: 'jwt' }), 18 | JwtModule.register({ 19 | secret: 'pingpong', 20 | signOptions: { 21 | expiresIn: '1d', 22 | }, 23 | }), 24 | TypeOrmModule.forFeature([ 25 | PlayerRepository, 26 | membership, 27 | roomRepository, 28 | RelationRepository 29 | ]), 30 | RelationModule, 31 | ], 32 | controllers: [UsersController], 33 | providers: [ 34 | UsersService, 35 | JwtStrategy, 36 | AppGateway, 37 | ], 38 | exports: [UsersService], 39 | }) 40 | export class PlayerModule {} -------------------------------------------------------------------------------- /src/backend/src/pong-game/default.gateway.ts: -------------------------------------------------------------------------------- 1 | import { Logger, OnModuleDestroy } from '@nestjs/common'; 2 | import { 3 | OnGatewayConnection, 4 | OnGatewayDisconnect, 5 | SubscribeMessage, 6 | WebSocketGateway, 7 | WebSocketServer, 8 | } from '@nestjs/websockets'; 9 | import { Server, Socket } from 'socket.io'; 10 | import { DefaultService } from './default.service'; 11 | 12 | @WebSocketGateway({ namespace: '/default', cors: true, path: '/game/default' }) 13 | export class DefaultGateway 14 | implements OnGatewayConnection, OnGatewayDisconnect 15 | { 16 | @WebSocketServer() wss: Server; 17 | private players: Socket[]; 18 | 19 | constructor(private defaultService: DefaultService) { 20 | this.players = []; 21 | } 22 | 23 | async handleConnection(client: Socket) { 24 | await this.defaultService.handleUserConnected(client, this.players, this.wss); 25 | } 26 | 27 | async handleDisconnect(client: Socket) { 28 | this.players = this.players.filter((clt) => { 29 | return clt.id !== client.id; 30 | }); 31 | await this.defaultService.handleUserDisconnected(this.wss, client); 32 | } 33 | 34 | @SubscribeMessage('UpKeyPressed') 35 | handleKeyUpPressed(client: Socket /* , data: any */): void { 36 | if (client.data.playground) { 37 | this.defaultService.handleKeyUpPressed(client); 38 | } 39 | } 40 | 41 | @SubscribeMessage('DownKeyPressed') 42 | handleKeyDownPressed(client: Socket /* , data: any */) { 43 | if (client.data.playground) { 44 | this.defaultService.handleKeyDownPressed(client); 45 | } 46 | } 47 | @SubscribeMessage('UpKeyUnpressed') 48 | handleKeyUpUnpressed(client: Socket /* , data: any */) { 49 | if (client.data.playground) { 50 | this.defaultService.handleKeyUpUnpressed(client); 51 | } 52 | } 53 | 54 | @SubscribeMessage('DownKeyUnpressed') 55 | handleKeyDownUnpressed(client: Socket /* , data: any */) { 56 | if (client.data.playground) { 57 | this.defaultService.handleKeyDownUnpressed(client); 58 | } 59 | } 60 | @SubscribeMessage('touchMove') 61 | handlTouchMove(client: Socket, data: { y: number }) { 62 | if (client.data.playground) { 63 | this.defaultService.handleTouchMove(client, data); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/difficult.gateway.ts: -------------------------------------------------------------------------------- 1 | import { Logger } from '@nestjs/common'; 2 | import { 3 | OnGatewayConnection, 4 | OnGatewayDisconnect, 5 | SubscribeMessage, 6 | WebSocketGateway, 7 | WebSocketServer, 8 | } from '@nestjs/websockets'; 9 | import { Server, Socket } from 'socket.io'; 10 | import { DifficultService } from './difficult.service'; 11 | 12 | @WebSocketGateway({ namespace: '/difficult', cors: true, path: '/game/difficult' }) 13 | export class DifficultGateway 14 | implements OnGatewayConnection, OnGatewayDisconnect 15 | { 16 | @WebSocketServer() wss: Server; 17 | private players: Socket[]; 18 | 19 | constructor(private difficultService: DifficultService) { 20 | this.players = []; 21 | } 22 | 23 | async handleConnection(client: Socket) { 24 | await this.difficultService.handleUserConnected(client, this.players, this.wss); 25 | } 26 | 27 | async handleDisconnect(client: Socket) { 28 | this.players = this.players.filter((clt) => { 29 | return clt.id !== client.id; 30 | }); 31 | await this.difficultService.handleUserDisconnected(this.wss, client); 32 | } 33 | 34 | @SubscribeMessage('UpKeyPressed') 35 | handleKeyUpPressed(client: Socket /* , data: any */): void { 36 | if (client.data.playground) { 37 | this.difficultService.handleKeyUpPressed(client); 38 | } 39 | } 40 | 41 | @SubscribeMessage('DownKeyPressed') 42 | handleKeyDownPressed(client: Socket /* , data: any */) { 43 | if (client.data.playground) { 44 | this.difficultService.handleKeyDownPressed(client); 45 | } 46 | } 47 | @SubscribeMessage('UpKeyUnpressed') 48 | handleKeyUpUnpressed(client: Socket /* , data: any */) { 49 | if (client.data.playground) { 50 | this.difficultService.handleKeyUpUnpressed(client); 51 | } 52 | } 53 | 54 | @SubscribeMessage('DownKeyUnpressed') 55 | handleKeyDownUnpressed(client: Socket /* , data: any */) { 56 | if (client.data.playground) { 57 | this.difficultService.handleKeyDownUnpressed(client); 58 | } 59 | } 60 | @SubscribeMessage('touchMove') 61 | handlTouchMove(client: Socket, data: { y: number }) { 62 | if (client.data.playground) { 63 | this.difficultService.handleTouchMove(client, data); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/dto/createGameHistory.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsIn, IsNotEmpty, IsNumber, IsString } from 'class-validator'; 2 | import { Player } from '../../players/player.entity'; 3 | import { GameMood } from '../interfaces'; 4 | 5 | export class CreateGameHistoryDto { 6 | @IsNotEmpty() 7 | @IsIn([ GameMood.DEFAULT, GameMood.DIFFICULT, GameMood.ONEVONE ]) 8 | mode: GameMood; 9 | 10 | @IsNotEmpty() 11 | winner: Player; 12 | 13 | @IsNotEmpty() 14 | loser: Player; 15 | 16 | @IsNotEmpty() 17 | @IsNumber() 18 | winnerScore: number; 19 | 20 | @IsNotEmpty() 21 | @IsNumber() 22 | loserScore: number; 23 | } 24 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/dto/createGameRoom.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsIn, IsNotEmpty, IsString } from 'class-validator'; 2 | import { GameMood } from '../interfaces'; 3 | 4 | export class CreateGameRoomDto { 5 | @IsNotEmpty() 6 | roomname: string; 7 | 8 | @IsNotEmpty() 9 | @IsIn([ GameMood.DEFAULT, GameMood.DIFFICULT, GameMood.ONEVONE ]) 10 | difficulty: GameMood ; 11 | 12 | @IsNotEmpty() 13 | @IsString() 14 | player1: string; 15 | 16 | @IsNotEmpty() 17 | @IsString() 18 | player2: string; 19 | } 20 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/interfaces/Ball.ts: -------------------------------------------------------------------------------- 1 | export interface BallInterface { 2 | x: number; 3 | y: number; 4 | speed: number; 5 | velocityX: number; 6 | velocityY: number; 7 | radius: number; 8 | color: string; 9 | } 10 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/interfaces/Paddle.ts: -------------------------------------------------------------------------------- 1 | export interface PaddleInterface { 2 | x: number; 3 | y: number; 4 | width: number; 5 | height: number; 6 | color: string; 7 | } 8 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/interfaces/Player.ts: -------------------------------------------------------------------------------- 1 | export interface PlayerInterface { 2 | id: number; 3 | name: string; 4 | avatar: string; 5 | } 6 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/interfaces/Playground.ts: -------------------------------------------------------------------------------- 1 | import { PaddleInterface } from './Paddle'; 2 | import { BallInterface } from './Ball'; 3 | import { ScoreBoardInterface } from './ScoreBoard'; 4 | 5 | export interface PlayGroundInterface { 6 | x: number; 7 | y: number; 8 | width: number; 9 | height: number; 10 | color: string; 11 | leftPaddle: PaddleInterface; 12 | rightPaddle: PaddleInterface; 13 | ball: BallInterface; 14 | score: ScoreBoardInterface; 15 | player1: string; 16 | player2: string; 17 | } 18 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/interfaces/ScoreBoard.ts: -------------------------------------------------------------------------------- 1 | export interface ScoreBoardInterface { 2 | playerOneScore: number; 3 | playerTwoScore: number; 4 | round: number; 5 | } 6 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/interfaces/game_mood.enum.ts: -------------------------------------------------------------------------------- 1 | export enum GameMood { 2 | DEFAULT = 'default', 3 | DIFFICULT = 'difficult', 4 | ONEVONE = 'oneVone', 5 | }; -------------------------------------------------------------------------------- /src/backend/src/pong-game/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Paddle'; 2 | export * from './Ball'; 3 | export * from './Playground'; 4 | export * from './ScoreBoard'; 5 | export * from './Player'; 6 | export * from './game_mood.enum'; -------------------------------------------------------------------------------- /src/backend/src/pong-game/one-v-one.gateway.ts: -------------------------------------------------------------------------------- 1 | import { Logger } from '@nestjs/common'; 2 | import { 3 | OnGatewayConnection, 4 | OnGatewayDisconnect, 5 | SubscribeMessage, 6 | WebSocketGateway, 7 | WebSocketServer 8 | } from '@nestjs/websockets'; 9 | import { Server, Socket } from 'socket.io'; 10 | import { OneVOneService } from './one-v-one.service'; 11 | 12 | @WebSocketGateway({ namespace: '/oneVone', cors: true, path: '/game/oneVone' }) 13 | export class OneVOneGateway 14 | implements OnGatewayConnection, OnGatewayDisconnect 15 | { 16 | @WebSocketServer() wss: Server; 17 | private players: Socket[]; 18 | 19 | constructor(private onevoneService: OneVOneService) { 20 | this.players = []; 21 | } 22 | 23 | async handleConnection(client: Socket) { 24 | await this.onevoneService.handleUserConnected(client, this.players, this.wss); 25 | } 26 | 27 | async handleDisconnect(client: Socket) { 28 | this.players = this.players.filter((clt) => { 29 | return clt.id !== client.id; 30 | }); 31 | await this.onevoneService.handleUserDisconnected(this.wss, client); 32 | } 33 | 34 | @SubscribeMessage('UpKeyPressed') 35 | handleKeyUpPressed(client: Socket /* , data: any */): void { 36 | if (client.data.playground) { 37 | this.onevoneService.handleKeyUpPressed(client); 38 | } 39 | } 40 | 41 | @SubscribeMessage('DownKeyPressed') 42 | handleKeyDownPressed(client: Socket /* , data: any */) { 43 | if (client.data.playground) { 44 | this.onevoneService.handleKeyDownPressed(client); 45 | } 46 | } 47 | @SubscribeMessage('UpKeyUnpressed') 48 | handleKeyUpUnpressed(client: Socket /* , data: any */) { 49 | if (client.data.playground) { 50 | this.onevoneService.handleKeyUpUnpressed(client); 51 | } 52 | } 53 | 54 | @SubscribeMessage('DownKeyUnpressed') 55 | handleKeyDownUnpressed(client: Socket /* , data: any */) { 56 | if (client.data.playground) { 57 | this.onevoneService.handleKeyDownUnpressed(client); 58 | } 59 | } 60 | @SubscribeMessage('touchMove') 61 | handlTouchMove(client: Socket, data: { y: number }) { 62 | if (client.data.playground) { 63 | this.onevoneService.handleTouchMove(client, data); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/pong-game.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Param, ParseIntPipe, UsePipes, ValidationPipe } from '@nestjs/common'; 2 | import { PongGameService } from './pong-game.service'; 3 | import { GameHistory } from './typeorm/game-history.entity'; 4 | import { GameRoom } from './typeorm/game-room.entity'; 5 | 6 | @Controller('pong-game') 7 | export class PongGameController { 8 | constructor(private pongGameService: PongGameService) {} 9 | 10 | @Get('/games-rooms') 11 | async getRooms(): Promise< { gamesRooms: GameRoom[] } > { 12 | return await this.pongGameService.getRooms(); 13 | } 14 | 15 | @Get('/games-history/:id') 16 | @UsePipes(ValidationPipe) 17 | async getGamesHistory( @Param('id', ParseIntPipe) id: number ): Promise< { gamesHistory: GameHistory[] } > { 18 | return await this.pongGameService.getGamesHistory(id); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/pong-game.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { TypeOrmModule } from '@nestjs/typeorm'; 3 | import { DefaultGateway } from './default.gateway'; 4 | import { DefaultService } from './default.service'; 5 | import { OneVOneGateway } from './one-v-one.gateway'; 6 | import { DifficultGateway } from './difficult.gateway'; 7 | import { DifficultService } from './difficult.service'; 8 | import { PongGameController } from './pong-game.controller'; 9 | import { PongGameService } from './pong-game.service'; 10 | import { GameRoom } from './typeorm/game-room.entity'; 11 | import { AuthModule } from 'src/auth/auth.module'; 12 | import { OneVOneService } from './one-v-one.service'; 13 | import { GameHistory } from './typeorm/game-history.entity'; 14 | 15 | @Module({ 16 | imports: [ 17 | TypeOrmModule.forFeature([GameRoom, GameHistory]), 18 | AuthModule, 19 | ], 20 | controllers: [PongGameController], 21 | providers: [ 22 | PongGameService, 23 | DefaultGateway, 24 | OneVOneGateway, 25 | DifficultGateway, 26 | DefaultService, 27 | DifficultService, 28 | OneVOneService, 29 | ], 30 | }) 31 | export class PongGameModule {} 32 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/typeorm/game-history.entity.ts: -------------------------------------------------------------------------------- 1 | import { Column, CreateDateColumn, Entity, ManyToMany, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; 2 | import { Player } from '../../players/player.entity'; 3 | import { GameMood } from '../interfaces'; 4 | 5 | @Entity() 6 | export class GameHistory { 7 | @PrimaryGeneratedColumn() 8 | id: number; 9 | 10 | @Column() 11 | mode: GameMood; 12 | 13 | @ManyToOne(() => Player) 14 | winner: Player; 15 | 16 | @ManyToOne(() => Player) 17 | loser: Player; 18 | 19 | @Column() 20 | winnerScore: number; 21 | 22 | @Column() 23 | loserScore: number; 24 | 25 | @CreateDateColumn() 26 | createdAt: Date; 27 | } -------------------------------------------------------------------------------- /src/backend/src/pong-game/typeorm/game-room.entity.ts: -------------------------------------------------------------------------------- 1 | import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; 2 | import { GameMood } from '../interfaces'; 3 | 4 | @Entity() 5 | export class GameRoom { 6 | @PrimaryGeneratedColumn() 7 | id: number; 8 | 9 | @Column() 10 | roomname: string; 11 | 12 | @Column() 13 | difficulty: GameMood; 14 | 15 | @Column() 16 | player1: string; 17 | 18 | @Column() 19 | player2: string; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/utils/Bounds.ts: -------------------------------------------------------------------------------- 1 | export interface Bounds { 2 | left: number; 3 | right: number; 4 | upper: number; 5 | lower: number; 6 | } 7 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/utils/PaddleController.ts: -------------------------------------------------------------------------------- 1 | import { Bounds } from './Bounds'; 2 | import { Paddle } from './Paddle'; 3 | 4 | export class PaddleController { 5 | private _paddle: Paddle; 6 | private _isKeyUpPressed: boolean; 7 | private _isKeyDownPressed: boolean; 8 | constructor(paddle: Paddle) { 9 | this._paddle = paddle; 10 | this._isKeyUpPressed = false; 11 | this._isKeyDownPressed = false; 12 | } 13 | keyUpPressed(): void { 14 | this._isKeyUpPressed = true; 15 | } 16 | keyUpUnpressed(): void { 17 | this._isKeyUpPressed = false; 18 | } 19 | 20 | keyDownPressed(): void { 21 | this._isKeyDownPressed = true; 22 | } 23 | keyDownUnpressed(): void { 24 | this._isKeyDownPressed = false; 25 | } 26 | 27 | get velocity(): number { 28 | let velocity = 0; 29 | if (this._isKeyUpPressed) velocity -= 1; 30 | if (this._isKeyDownPressed) velocity += 1; 31 | return velocity; 32 | } 33 | 34 | update(bounds: Bounds): void { 35 | if (this.velocity > 0) { 36 | this._paddle.moveDown(bounds); 37 | } else if (this.velocity) { 38 | this._paddle.moveUp(bounds); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/utils/Player.ts: -------------------------------------------------------------------------------- 1 | import { PlayerInterface } from '../interfaces'; 2 | 3 | export class Player { 4 | private _id: number; 5 | private _name: string; 6 | private _avatar: string; 7 | 8 | constructor(id: number, name: string, avatar: string) { 9 | this._id = id; 10 | this._name = name; 11 | this._avatar = avatar; 12 | } 13 | 14 | public get id(): number { 15 | return this._id; 16 | } 17 | public get name(): string { 18 | return this._name; 19 | } 20 | public get avatar(): string { 21 | return this._avatar; 22 | } 23 | 24 | public getPlayerInterface(): PlayerInterface { 25 | return { 26 | id: this._id, 27 | name: this._name, 28 | avatar: this.avatar, 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/utils/ScoreBoard.ts: -------------------------------------------------------------------------------- 1 | import { ScoreBoardInterface } from '../interfaces'; 2 | 3 | export class ScoreBoard { 4 | private _playerOneScore: number; 5 | private _playerTwoScore: number; 6 | private _round: number; 7 | 8 | constructor() { 9 | this.reset(); 10 | } 11 | 12 | public get playerOneScore(): number { 13 | return this._playerOneScore; 14 | } 15 | 16 | public get playerTwoScore(): number { 17 | return this._playerTwoScore; 18 | } 19 | 20 | public set playerOneScore(score: number) { 21 | this._playerOneScore = score; 22 | } 23 | 24 | public set playerTwoScore(score: number) { 25 | this._playerTwoScore = score; 26 | } 27 | 28 | public get round(): number { 29 | return this._round; 30 | } 31 | 32 | public PlayerOneScored(): void { 33 | this._playerOneScore++; 34 | this._round++; 35 | } 36 | 37 | public PlayerTwoScored(): void { 38 | this._playerTwoScore++; 39 | this._round++; 40 | } 41 | 42 | public getScoreBoardInterface(): ScoreBoardInterface { 43 | return { 44 | playerOneScore: this._playerOneScore, 45 | playerTwoScore: this._playerTwoScore, 46 | round: this._round, 47 | }; 48 | } 49 | 50 | public reset() { 51 | this._playerOneScore = 0; 52 | this._playerTwoScore = 0; 53 | this._round = 0; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/backend/src/pong-game/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Paddle'; 2 | export * from './Ball'; 3 | export * from './PlayGround'; 4 | export * from './ScoreBoard'; 5 | export * from './Player'; 6 | -------------------------------------------------------------------------------- /src/backend/src/relations/dto-relation/create-relation.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsNotEmpty } from "class-validator"; 2 | import { Player } from "../../players/player.entity"; 3 | 4 | export class CreateRelationDto { 5 | 6 | @IsNotEmpty() 7 | receiver: Player; 8 | } -------------------------------------------------------------------------------- /src/backend/src/relations/dto-relation/get-relation-filter.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsIn, IsNotEmpty, IsNumber, IsOptional } from "class-validator"; 2 | import { Player } from "../../players/player.entity"; 3 | import { RelationStatus } from "../relation_status.enum"; 4 | 5 | export class GetRelationFilterDto { 6 | 7 | @IsOptional() 8 | @IsNotEmpty() 9 | @IsNumber() 10 | id: number; 11 | 12 | @IsOptional() 13 | @IsIn([RelationStatus.FRIEND, RelationStatus.BLOCKED]) 14 | status: RelationStatus; 15 | 16 | @IsOptional() 17 | @IsNotEmpty() 18 | @IsNumber() 19 | receiver: number; 20 | 21 | @IsOptional() 22 | @IsNotEmpty() 23 | sender: Player; 24 | } -------------------------------------------------------------------------------- /src/backend/src/relations/relation.entity.ts: -------------------------------------------------------------------------------- 1 | import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm"; 2 | import { Player } from "../players/player.entity"; 3 | import { RelationStatus } from "./relation_status.enum"; 4 | 5 | @Entity('relation') 6 | export class Relation extends BaseEntity { 7 | 8 | @PrimaryGeneratedColumn() 9 | id: number; 10 | 11 | @Column() 12 | status: RelationStatus; 13 | 14 | @Column() 15 | receiver: number; 16 | 17 | @ManyToOne(type => Player, player => player.senders) 18 | sender: Player; 19 | } -------------------------------------------------------------------------------- /src/backend/src/relations/relation_status.enum.ts: -------------------------------------------------------------------------------- 1 | export enum RelationStatus { 2 | FRIEND = 'friend', 3 | BLOCKED = 'blocked' 4 | } -------------------------------------------------------------------------------- /src/backend/src/relations/relations.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Delete, Param, ParseIntPipe, Post, Req, UsePipes, ValidationPipe } from "@nestjs/common"; 2 | import { AuthGuard } from "@nestjs/passport"; 3 | import { Player } from "../players/player.entity"; 4 | import { Relation } from "./relation.entity"; 5 | import { RelationsService } from "./relations.service"; 6 | import { RelationStatus } from "./relation_status.enum"; 7 | import { Request, Express } from "express"; 8 | import { UsersService } from "../players/players.service"; 9 | 10 | 11 | @Controller('/relation') 12 | export class RelationsController { 13 | constructor( 14 | private readonly relationService: RelationsService, 15 | private readonly usersService: UsersService, 16 | ) {} 17 | 18 | @Post('add/:id') 19 | @UsePipes(ValidationPipe) 20 | async addFriend( 21 | @Req() req: Request, 22 | // @Request() request: Express.Request, 23 | @Param('id', ParseIntPipe) friend_id: number, 24 | ): Promise { 25 | const user = await this.usersService.verifyToken(req.cookies.connect_sid); 26 | return this.relationService.addFriend(user, friend_id); 27 | } 28 | 29 | @Post('block/:id') 30 | @UsePipes(ValidationPipe) 31 | async blockPlayer( 32 | @Req() req: Request, 33 | @Param('id', ParseIntPipe) blocked_id: number, 34 | ): Promise { 35 | const user = await this.usersService.verifyToken(req.cookies.connect_sid); 36 | return this.relationService.blockPlayer(user, blocked_id); 37 | } 38 | 39 | @Delete('unblock/:id') 40 | async unblock( 41 | @Req() req: Request, 42 | @Param('id', ParseIntPipe) unblock_id: number, 43 | ): Promise { 44 | const user = await this.usersService.verifyToken(req.cookies.connect_sid); 45 | return this.relationService.unblock(user, unblock_id); 46 | } 47 | 48 | @Delete('unfollow/:id') 49 | async removeFriend( 50 | @Req() req: Request, 51 | @Param('id', ParseIntPipe) unfollow_id: number, 52 | ): Promise { 53 | const user = await this.usersService.verifyToken(req.cookies.connect_sid); 54 | return this.relationService.removeFriend(user, unfollow_id); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /src/backend/src/relations/relations.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { JwtModule } from '@nestjs/jwt'; 3 | import { PassportModule } from '@nestjs/passport'; 4 | import { TypeOrmModule } from '@nestjs/typeorm'; 5 | import { PlayerRepository } from '../players/player.repository'; 6 | import { PlayerModule } from '../players/players.module'; 7 | import { UsersService } from '../players/players.service'; 8 | import { RelationRepository } from './relation.repository'; 9 | import { RelationsController } from "./relations.controller"; 10 | import { RelationsService } from "./relations.service"; 11 | 12 | @Module({ 13 | imports: [ 14 | PassportModule.register({ defaultStrategy: 'jwt' }), 15 | JwtModule.register({ 16 | secret: 'pingpong', 17 | signOptions: { 18 | // expiresIn: '1d', 19 | expiresIn: 3600, 20 | }, 21 | }), 22 | TypeOrmModule.forFeature([RelationRepository]), 23 | TypeOrmModule.forFeature([PlayerRepository]), 24 | ], 25 | controllers: [RelationsController], 26 | providers: [ 27 | RelationsService, 28 | UsersService, 29 | ], 30 | exports: [RelationsService], 31 | }) 32 | export class RelationModule {} -------------------------------------------------------------------------------- /src/backend/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/backend/test/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { INestApplication } from '@nestjs/common'; 3 | import * as request from 'supertest'; 4 | import { AppModule } from '../src/app.module'; 5 | 6 | describe('AppController (e2e)', () => { 7 | let app: INestApplication; 8 | 9 | beforeEach(async () => { 10 | const moduleFixture: TestingModule = await Test.createTestingModule({ 11 | imports: [AppModule], 12 | }).compile(); 13 | 14 | app = moduleFixture.createNestApplication(); 15 | await app.init(); 16 | }); 17 | 18 | it('/ (GET)', () => { 19 | return request(app.getHttpServer()) 20 | .get('/') 21 | .expect(200) 22 | .expect('Hello World!'); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /src/backend/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/backend/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /src/backend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/frontend/.dockerignore: -------------------------------------------------------------------------------- 1 | **/node_modules/ 2 | **/dist 3 | -------------------------------------------------------------------------------- /src/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env -------------------------------------------------------------------------------- /src/frontend/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:latest as build-stage 2 | WORKDIR /app 3 | COPY package*.json ./ 4 | RUN npm install 5 | COPY ./ . 6 | RUN npm run build 7 | 8 | FROM nginx as production-stage 9 | RUN mkdir /app 10 | COPY --from=build-stage /app/public /app 11 | COPY --from=build-stage /app/dist /app 12 | COPY nginx.conf /etc/nginx/nginx.conf 13 | -------------------------------------------------------------------------------- /src/frontend/README.md: -------------------------------------------------------------------------------- 1 | # Vue 3 + Vite 2 | 3 | This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 ` 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/frontend/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | trandandan 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/frontend/nginx.conf: -------------------------------------------------------------------------------- 1 | user nginx; 2 | worker_processes 1; 3 | error_log /var/log/nginx/error.log warn; 4 | pid /var/run/nginx.pid; 5 | events { 6 | worker_connections 1024; 7 | } 8 | http { 9 | include /etc/nginx/mime.types; 10 | default_type application/octet-stream; 11 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 12 | '$status $body_bytes_sent "$http_referer" ' 13 | '"$http_user_agent" "$http_x_forwarded_for"'; 14 | access_log /var/log/nginx/access.log main; 15 | sendfile on; 16 | keepalive_timeout 65; 17 | server { 18 | listen 80; 19 | server_name localhost; 20 | location / { 21 | root /app; 22 | index index.html; 23 | try_files $uri $uri/ /index.html; 24 | } 25 | error_page 500 502 503 504 /50x.html; 26 | location = /50x.html { 27 | root /usr/share/nginx/html; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tr", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "preview": "vite preview" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.27.2", 12 | "core-js": "^3.8.3", 13 | "json-server": "^0.17.0", 14 | "request": "^2.88.2", 15 | "sass": "^1.52.3", 16 | "socket.io-client": "^4.5.1", 17 | "vue": "^3.2.13", 18 | "vue-axios": "^3.4.1", 19 | "vue-cookies": "^1.8.1", 20 | "vue-router": "^4.0.15" 21 | }, 22 | "devDependencies": { 23 | "@typescript-eslint/eslint-plugin": "^5.4.0", 24 | "@typescript-eslint/parser": "^5.4.0", 25 | "@vitejs/plugin-vue": "^2.3.3", 26 | "@vue/cli-plugin-babel": "~5.0.0", 27 | "@vue/cli-plugin-eslint": "~5.0.0", 28 | "@vue/cli-plugin-router": "~5.0.0", 29 | "@vue/cli-plugin-typescript": "~5.0.0", 30 | "@vue/cli-service": "~5.0.0", 31 | "@vue/eslint-config-typescript": "^9.1.0", 32 | "autoprefixer": "^10.4.7", 33 | "eslint": "^7.32.0", 34 | "eslint-plugin-vue": "^8.0.3", 35 | "postcss": "^8.4.14", 36 | "ps-scrollbar-tailwind": "^0.0.1", 37 | "tailwind-scrollbar": "^1.3.1", 38 | "tailwindcss": "^3.0.24", 39 | "typescript": "~4.5.5", 40 | "vite": "^2.9.9" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/frontend/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /src/frontend/public/assets/aes-salm.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/public/assets/aes-salm.jpeg -------------------------------------------------------------------------------- /src/frontend/public/assets/dsdsd.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/public/assets/dsdsd.jpeg -------------------------------------------------------------------------------- /src/frontend/public/assets/ggggh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/public/assets/ggggh.png -------------------------------------------------------------------------------- /src/frontend/public/assets/ikram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/public/assets/ikram.png -------------------------------------------------------------------------------- /src/frontend/public/assets/ikrax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/public/assets/ikrax.png -------------------------------------------------------------------------------- /src/frontend/public/assets/mlachheb.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/public/assets/mlachheb.jpeg -------------------------------------------------------------------------------- /src/frontend/public/assets/mlachheb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/public/assets/mlachheb.png -------------------------------------------------------------------------------- /src/frontend/public/assets/oel-yous.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/public/assets/oel-yous.jpeg -------------------------------------------------------------------------------- /src/frontend/public/assets/oel-yous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/public/assets/oel-yous.png -------------------------------------------------------------------------------- /src/frontend/public/assets/oumixa.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/public/assets/oumixa.jpeg -------------------------------------------------------------------------------- /src/frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/public/favicon.ico -------------------------------------------------------------------------------- /src/frontend/src/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .env -------------------------------------------------------------------------------- /src/frontend/src/App.vue: -------------------------------------------------------------------------------- 1 | 2 | 5 | 32 | 33 | 36 | -------------------------------------------------------------------------------- /src/frontend/src/Styles/container.sass: -------------------------------------------------------------------------------- 1 | .Container, 2 | .Container-fluid, 3 | .Container-xxl, 4 | .Container-xl, 5 | .Container-lg, 6 | .Container-md, 7 | .Container-sm 8 | width: 100% 9 | padding-right: var(--bs-gutter-x, 0.75rem) 10 | padding-left: var(--bs-gutter-x, 0.75rem) 11 | margin-right: auto 12 | margin-left: auto 13 | 14 | @media (min-width:640px) 15 | .Container- sm, .Container 16 | max-width: 639px 17 | @media (min-width: 768px) 18 | .Container-md, .Container-sm, .Container 19 | max-width: 767px 20 | @media (min-width: 1024px) 21 | .Container-lg, .Container-md, .Container-sm, .Container 22 | max-width: 1023px 23 | @media (min-width: 1280px) 24 | .Container-xl, .Container-lg, .Container-md, .Container-sm, .Container 25 | max-width: 1279px 26 | @media (min-width: 1536px) 27 | .Container-xxl, .Container-xl, .Container-lg, .Container-md, .Container-sm, .Container 28 | max-width: 1535px 29 | 30 | .underline 31 | position: relative 32 | color: #FFCD9F 33 | &::after 34 | content: "" 35 | position: absolute 36 | bottom: -5px 37 | left: 0 38 | right: 0 39 | width: 100% 40 | height: 3px 41 | background: linear-gradient(90deg,rgba(255, 142, 38, 0) -0.85%,#ffcd9f 45.9%,rgba(255, 142, 38, 0) 100%) -------------------------------------------------------------------------------- /src/frontend/src/assets/Public.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/Public.png -------------------------------------------------------------------------------- /src/frontend/src/assets/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/bg.jpg -------------------------------------------------------------------------------- /src/frontend/src/assets/bg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/bg1.jpg -------------------------------------------------------------------------------- /src/frontend/src/assets/bronze.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/bronze.png -------------------------------------------------------------------------------- /src/frontend/src/assets/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/cover.png -------------------------------------------------------------------------------- /src/frontend/src/assets/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/edit.png -------------------------------------------------------------------------------- /src/frontend/src/assets/framdani.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/framdani.jpeg -------------------------------------------------------------------------------- /src/frontend/src/assets/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/github.png -------------------------------------------------------------------------------- /src/frontend/src/assets/gold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/gold.png -------------------------------------------------------------------------------- /src/frontend/src/assets/group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/group.png -------------------------------------------------------------------------------- /src/frontend/src/assets/iidzim.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/iidzim.jpeg -------------------------------------------------------------------------------- /src/frontend/src/assets/medal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/medal.png -------------------------------------------------------------------------------- /src/frontend/src/assets/mlachheb.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/mlachheb.jpeg -------------------------------------------------------------------------------- /src/frontend/src/assets/oel-yous.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/oel-yous.jpeg -------------------------------------------------------------------------------- /src/frontend/src/assets/pong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/pong.png -------------------------------------------------------------------------------- /src/frontend/src/assets/silver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oumeimatt/ft_transcendence/51a435c47817fc7252c1656bc2b3bbded5077c9d/src/frontend/src/assets/silver.png -------------------------------------------------------------------------------- /src/frontend/src/components/Footer.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | -------------------------------------------------------------------------------- /src/frontend/src/components/LoadingBar.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 11 | 12 | -------------------------------------------------------------------------------- /src/frontend/src/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; -------------------------------------------------------------------------------- /src/frontend/src/interfaces/Ball.ts: -------------------------------------------------------------------------------- 1 | export interface BallInterface { 2 | x: number; 3 | y: number; 4 | speed: number; 5 | velocityX: number; 6 | velocityY: number; 7 | radius: number; 8 | color: string; 9 | } -------------------------------------------------------------------------------- /src/frontend/src/interfaces/Bounds.ts: -------------------------------------------------------------------------------- 1 | export interface Bounds { 2 | left: number; 3 | right: number; 4 | upper: number; 5 | lower: number; 6 | } 7 | -------------------------------------------------------------------------------- /src/frontend/src/interfaces/GameRoom.ts: -------------------------------------------------------------------------------- 1 | export interface GameRoom { 2 | id: number; 3 | roomname: string; 4 | difficulty: string; 5 | player1: string; 6 | player2: string; 7 | } 8 | -------------------------------------------------------------------------------- /src/frontend/src/interfaces/Paddle.ts: -------------------------------------------------------------------------------- 1 | export interface PaddleInterface { 2 | x: number; 3 | y: number; 4 | width: number; 5 | height: number; 6 | color: string; 7 | } -------------------------------------------------------------------------------- /src/frontend/src/interfaces/Player.ts: -------------------------------------------------------------------------------- 1 | export interface PlayerInterface { 2 | id: number; 3 | name: string; 4 | avatar: string; 5 | } 6 | -------------------------------------------------------------------------------- /src/frontend/src/interfaces/PlayerProfile.ts: -------------------------------------------------------------------------------- 1 | export interface PlayerProfile { 2 | id: number, 3 | username: string 4 | avatar: string, 5 | level: number, 6 | status: string, 7 | two_fa: boolean, 8 | } -------------------------------------------------------------------------------- /src/frontend/src/interfaces/Playground.ts: -------------------------------------------------------------------------------- 1 | import { PaddleInterface } from "./Paddle"; 2 | import { BallInterface } from "./Ball"; 3 | import { ScoreBoardInterface } from "./ScoreBoard"; 4 | 5 | export interface PlaygroundInterface { 6 | x: number; 7 | y: number; 8 | width: number; 9 | height: number; 10 | color: string; 11 | ball: BallInterface; 12 | leftPaddle: PaddleInterface; 13 | rightPaddle: PaddleInterface; 14 | score: ScoreBoardInterface; 15 | player1: string; 16 | player2: string; 17 | } -------------------------------------------------------------------------------- /src/frontend/src/interfaces/ScoreBoard.ts: -------------------------------------------------------------------------------- 1 | export interface ScoreBoardInterface { 2 | playerOneScore: number; 3 | playerTwoScore: number; 4 | round: number; 5 | } -------------------------------------------------------------------------------- /src/frontend/src/interfaces/UserInfos.ts: -------------------------------------------------------------------------------- 1 | import { PlayerProfile } from "./PlayerProfile" 2 | export interface UserInfos { 3 | isFriend: boolean, 4 | userIsBlocked: boolean, 5 | amIBlocked: boolean 6 | } -------------------------------------------------------------------------------- /src/frontend/src/interfaces/chatRoom.ts: -------------------------------------------------------------------------------- 1 | export interface chatRoom { 2 | name: string; 3 | privacy: string; 4 | password: string; 5 | players: string[]; 6 | } -------------------------------------------------------------------------------- /src/frontend/src/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./Paddle"; 2 | export * from "./Ball"; 3 | export * from "./Playground"; 4 | export * from "./ScoreBoard"; 5 | export * from "./Player"; 6 | export * from "./GameRoom"; 7 | -------------------------------------------------------------------------------- /src/frontend/src/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import App from './App.vue' 3 | import './index.css' 4 | import router from './router' 5 | import * as Vue from 'vue' 6 | import axios from 'axios' 7 | import VueAxios from 'vue-axios' 8 | 9 | const app = createApp(App).use(router) 10 | app.use(VueAxios, axios) 11 | 12 | app.mount('#app') 13 | 14 | -------------------------------------------------------------------------------- /src/frontend/src/views/Chat.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 33 | -------------------------------------------------------------------------------- /src/frontend/src/views/ChatRoom.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 36 | -------------------------------------------------------------------------------- /src/frontend/src/views/EmptyChat.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 24 | -------------------------------------------------------------------------------- /src/frontend/src/views/Game.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | -------------------------------------------------------------------------------- /src/frontend/src/views/Signin.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 23 | 24 | -------------------------------------------------------------------------------- /src/frontend/tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | content: [ 3 | "./index.html", 4 | "./src/**/*.{vue,js,ts,jsx,tsx}", 5 | ], 6 | theme: { 7 | extend: { 8 | height: { 9 | 'screen-4' : '40vh' 10 | }, 11 | colors: { 12 | 'myblue' : 'rgb(28, 34, 53)', 13 | 'zho': '#5B68B3' 14 | }, 15 | maxHeight: { 16 | '1/3': '10vh', 17 | '2/3': '30vh', 18 | '2/5': '20vh', 19 | '3/5': '35vh', 20 | '4/5': '80vh', 21 | '4/6': '66.666667%', 22 | '5/6': '90vh' 23 | 24 | }, 25 | height: { 26 | 'small': '5vh', 27 | 'screen': '95vh' 28 | }, 29 | padding: { 30 | 'small': '2vh', 31 | } 32 | } 33 | }, 34 | plugins: [], 35 | variants: { 36 | extend: {}, 37 | }, 38 | plugins: [ 39 | require('ps-scrollbar-tailwind'), 40 | ], 41 | } 42 | -------------------------------------------------------------------------------- /src/frontend/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import vue from '@vitejs/plugin-vue' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [vue()], 7 | server: { 8 | host: '0.0.0.0' 9 | } 10 | }) 11 | --------------------------------------------------------------------------------