Skip to content

Commit

Permalink
dernier commit promis
Browse files Browse the repository at this point in the history
  • Loading branch information
jean519 committed Feb 8, 2024
1 parent df84df0 commit 885dd1f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
34 changes: 31 additions & 3 deletions backend/seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,44 @@ const seed = async () => {

await Promise.all(queriesGame);

const sendPlayer = [];

sendPlayer.push(
database.query(
"insert into player(role_id,username,email,password) values(?,?,?,?)",
[
2,
"WildyGamer",
"WildyGamer@gmail.com",
"$argon2id$v=19$m=65536,t=3,p=4$khzdtRAGFeEjX3JOP8ahtQ$sCKskfRURxiMENC8BwuI9UT7om2gvEy+hUwerpNys9k",
]
)
);
await Promise.all(sendPlayer);

const sendProfil = [];
sendProfil.push(
database.query(
"insert into profile(bio,avatar,alt,player_id) values(?,?,?,?)",
[
"Titulus voluptatem thesis soleo cupressus voluptatum ad ulciscor absorbeo cursim. Bestia tabella ultio cresco una tepidus ambitus celebrer autem. Vae cedo adiuvo pectus capio suffoco socius suadeo ea.",
"https://avatars.githubusercontent.com/u/40671908",
"via profilwe avatar",
22,
]
)
);
await Promise.all(sendProfil);

const queryParty = [];
for (let i = 0; i <= 25; i += 1) {
for (let i = 0; i <= 22; i += 1) {
const startDate = faker.date.past({ years: 1 });
const d = new Date(startDate);
queryParty.push(
database.query(
"insert into party(player_id,game_id,start_time,end_time,is_won) values (?,?,?,?,?)",
[
Math.ceil(Math.random() * 16),
Math.ceil(Math.random() * 22),
Math.ceil(Math.random() * 3),
startDate,
new Date(d.getTime() + Math.ceil(Math.random() * 45 * 60000)),
Expand All @@ -123,7 +152,6 @@ const seed = async () => {
);
}

// Wait for all the insertion queries to complete
await Promise.all(queriesProfile);

// requete
Expand Down
File renamed without changes
6 changes: 4 additions & 2 deletions frontend/src/components/header/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import { Link } from "react-router-dom";
import logo from "../../assets/logo2.png";
import ButtonConected from "../input/ButtonConected";
import InputProfil from "../input/InputProfil";
Expand All @@ -7,7 +7,9 @@ import AdminButton from "../input/AdminButton";
function Header() {
return (
<div className="headerContainer">
<img src={logo} alt="logo" width={50} style={{ marginLeft: "25px" }} />
<Link to="/">
<img src={logo} alt="logo" width={50} style={{ marginLeft: "25px" }} />
</Link>
<InputProfil />
<AdminButton />
<ButtonConected />
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/profilContainer/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import division from "../../services/divisions";
function ProfilContainer() {
const { profil, connected } = useContext(AuthContext);

if (connected && connected.login && connected.login.username) {
if (connected && connected.login && connected.login.username && profil) {
return (
<div className="info-profil-container">
<div className="user-info">
Expand Down Expand Up @@ -37,6 +37,7 @@ function ProfilContainer() {
</div>
);
}
return null;
}

export default ProfilContainer;

0 comments on commit 885dd1f

Please sign in to comment.