fix invite and match history not done

This commit is contained in:
Alexandre POMMIER 2023-06-24 19:39:16 +02:00
parent 38052b5034
commit c6fe3a5a99
7 changed files with 34 additions and 23 deletions

12
.env
View File

@ -12,15 +12,9 @@
#URL #URL
NGINX_ENVSUBST_TEMPLATE_SUFFIX=".conf" NGINX_ENVSUBST_TEMPLATE_SUFFIX=".conf"
BASE_URL=bess-f2r2s16:8080
# BASE_URL=http://localhost REACT_APP_BASE_URL=bess-f2r2s16:8080
# SOCKET_URL=localhost:8080 REDIRECT_URI=http://bess-f2r2s16:8080/api/auth/login
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
POSTGRES_HOST=postgresql POSTGRES_HOST=postgresql
POSTGRES_USER=postgres POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres POSTGRES_PASSWORD=postgres

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/17 01:00:25 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View File

@ -82,7 +82,7 @@ export class User {
} }
@Entity() @Entity({name: 'MatchLog' })
export class MatchLog { export class MatchLog {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
id: number; id: number;

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/17 01:00:07 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,6 +75,8 @@ export class UsersService {
user.friendRequest = user.friendRequest || []; user.friendRequest = user.friendRequest || [];
if (user.friendRequest.find(item => item === username)) if (user.friendRequest.find(item => item === username))
return (1); return (1);
if (user.friends.find(item => item === username))
return (1);
user.friendRequest.push(username); user.friendRequest.push(username);
this.save(user); this.save(user);
return (1); return (1);
@ -100,12 +102,19 @@ export class UsersService {
async getHistory(username: string) { async getHistory(username: string) {
const user = await this.findOne(username); const user = await this.findOne(username);
if (user) { if (user)
const children = user.children; {
console.log(user);
console.log(user.children); // or perform any operations with the children // const ret = await this.matchRepository.query("SELECT * FROM \"MatchLog\" WHERE id = ($1);", [user.id]);
return children; 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) { async addFriend(user: User, username: string) {

View File

@ -1,5 +1,5 @@
REACT_APP_BASE_URL=bess-f2r5s11:8080 REACT_APP_BASE_URL=bess-f2r2s16:8080
REACT_APP_SOCKET_URL=bess-f2r5s11 REACT_APP_SOCKET_URL=bess-f2r2s16
REACT_APP_API_SECRET=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 REACT_APP_API_SECRET=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
REACT_APP_CLIENT_UID=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41 REACT_APP_CLIENT_UID=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41

View File

@ -756,9 +756,8 @@ async function draw(timestamp: number)
vX -= 0.0001; vX -= 0.0001;
} }
send_forced_info(); send_forced_info();
// console.log(`vx = ${vX}`);
} }
else if (event.code === "KeyR") else if (event.code === "KeyW")
{ {
if (!superpowerModifier) if (!superpowerModifier)
return ; return ;
@ -771,6 +770,13 @@ async function draw(timestamp: number)
paddleY = canvas.height / 2 - paddleHeight / 2; paddleY = canvas.height / 2 - paddleHeight / 2;
console.log('Cinq secondes se sont écoulées.'); console.log('Cinq secondes se sont écoulées.');
}, 5000); }, 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);
} }
}); });

View File

@ -23,6 +23,8 @@
} }
.profilePic{ .profilePic{
margin-left: 10px;
/* margin-top: 10px; */
height: 30px; height: 30px;
width: 30px; width: 30px;
border-radius: 50%; border-radius: 50%;