From c6fe3a5a993e1f25c6bb4e6d315f58219ebfa210 Mon Sep 17 00:00:00 2001 From: Alexandre POMMIER Date: Sat, 24 Jun 2023 19:39:16 +0200 Subject: [PATCH] fix invite and match history not done --- .env | 12 +++-------- containers/api/src/chat/chat.service.ts | 2 +- containers/api/src/model/user.entity.ts | 2 +- containers/api/src/users/users.service.ts | 25 +++++++++++++++-------- containers/react/.env | 4 ++-- containers/react/src/pages/canvas.tsx | 10 +++++++-- containers/react/src/styles/Game.css | 2 ++ 7 files changed, 34 insertions(+), 23 deletions(-) diff --git a/.env b/.env index d5dc4963..53fa4ec5 100644 --- a/.env +++ b/.env @@ -12,15 +12,9 @@ #URL NGINX_ENVSUBST_TEMPLATE_SUFFIX=".conf" - -# BASE_URL=http://localhost -# SOCKET_URL=localhost:8080 -BASE_URL=localhost:8080 -REACT_APP_BASE_URL=localhost:8080 -REDIRECT_URI=http://localhost:8080/api/auth/login -#postgres var -# POSTGRES_HOST=127.0.0.1 -# DB_TYPE=postgres +BASE_URL=bess-f2r2s16:8080 +REACT_APP_BASE_URL=bess-f2r2s16:8080 +REDIRECT_URI=http://bess-f2r2s16:8080/api/auth/login POSTGRES_HOST=postgresql POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres diff --git a/containers/api/src/chat/chat.service.ts b/containers/api/src/chat/chat.service.ts index 05415e63..d69bad68 100644 --- a/containers/api/src/chat/chat.service.ts +++ b/containers/api/src/chat/chat.service.ts @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/17 01:00:25 by apommier #+# #+# */ -/* Updated: 2023/06/23 19:37:41 by apommier ### ########.fr */ +/* Updated: 2023/06/24 18:47:59 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/containers/api/src/model/user.entity.ts b/containers/api/src/model/user.entity.ts index 5fd7c12b..55d93f59 100644 --- a/containers/api/src/model/user.entity.ts +++ b/containers/api/src/model/user.entity.ts @@ -82,7 +82,7 @@ export class User { } -@Entity() +@Entity({name: 'MatchLog' }) export class MatchLog { @PrimaryGeneratedColumn() id: number; diff --git a/containers/api/src/users/users.service.ts b/containers/api/src/users/users.service.ts index 4d957c2b..796a7535 100644 --- a/containers/api/src/users/users.service.ts +++ b/containers/api/src/users/users.service.ts @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/17 01:00:07 by apommier #+# #+# */ -/* Updated: 2023/06/24 17:38:24 by apommier ### ########.fr */ +/* Updated: 2023/06/24 19:29:33 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -75,8 +75,10 @@ export class UsersService { user.friendRequest = user.friendRequest || []; if (user.friendRequest.find(item => item === username)) return (1); + if (user.friends.find(item => item === username)) + return (1); user.friendRequest.push(username); - this.save(user); + this.save(user); return (1); } @@ -99,13 +101,20 @@ export class UsersService { async getHistory(username: string) { const user = await this.findOne(username); - - if (user) { - const children = user.children; - console.log(user); - console.log(user.children); // or perform any operations with the children - return children; + + if (user) + { + + // const ret = await this.matchRepository.query("SELECT * FROM \"MatchLog\" WHERE id = ($1);", [user.id]); + const ret = await this.matchRepository.query("SELECT * FROM \"MatchLog\""); + console.log("all match= ", ret); } + // const children = user.children; + // console.log(user); + // console.log(user.children); // or perform any operations with the children + // return children; + + // } } async addFriend(user: User, username: string) { diff --git a/containers/react/.env b/containers/react/.env index 3f06b0f2..0554a08a 100644 --- a/containers/react/.env +++ b/containers/react/.env @@ -1,5 +1,5 @@ -REACT_APP_BASE_URL=bess-f2r5s11:8080 -REACT_APP_SOCKET_URL=bess-f2r5s11 +REACT_APP_BASE_URL=bess-f2r2s16:8080 +REACT_APP_SOCKET_URL=bess-f2r2s16 REACT_APP_API_SECRET=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 REACT_APP_CLIENT_UID=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41 diff --git a/containers/react/src/pages/canvas.tsx b/containers/react/src/pages/canvas.tsx index b757caed..5bcfdb45 100644 --- a/containers/react/src/pages/canvas.tsx +++ b/containers/react/src/pages/canvas.tsx @@ -756,9 +756,8 @@ async function draw(timestamp: number) vX -= 0.0001; } send_forced_info(); - // console.log(`vx = ${vX}`); } - else if (event.code === "KeyR") + else if (event.code === "KeyW") { if (!superpowerModifier) return ; @@ -771,6 +770,13 @@ async function draw(timestamp: number) paddleY = canvas.height / 2 - paddleHeight / 2; console.log('Cinq secondes se sont écoulées.'); }, 5000); + + // setTimeout(() => { + // // code à exécuter après 5 secondes + // paddleHeight = canvas.height * 0.25; + // paddleY = canvas.height / 2 - paddleHeight / 2; + // console.log('Cinq secondes se sont écoulées.'); + // }, 5000); } }); diff --git a/containers/react/src/styles/Game.css b/containers/react/src/styles/Game.css index 7b2adb2a..f2a2f498 100644 --- a/containers/react/src/styles/Game.css +++ b/containers/react/src/styles/Game.css @@ -23,6 +23,8 @@ } .profilePic{ + margin-left: 10px; + /* margin-top: 10px; */ height: 30px; width: 30px; border-radius: 50%;