From dde6eaa8d4ac40912243e3fba929e1d9bfe9b28d Mon Sep 17 00:00:00 2001 From: "mael.daim" Date: Sun, 3 Dec 2023 13:59:21 +0100 Subject: [PATCH] Completing team's actions, adding css and implementing account within the teams --- sql/setup-tables.sql | 2 +- src/App/Controller/TeamController.php | 11 +++++++++++ src/Core/Gateway/TeamGateway.php | 2 +- src/Core/Model/TeamModel.php | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/sql/setup-tables.sql b/sql/setup-tables.sql index eb74877..7c012eb 100644 --- a/sql/setup-tables.sql +++ b/sql/setup-tables.sql @@ -46,5 +46,5 @@ CREATE TABLE Member id_user integer, role text CHECK (role IN ('Coach', 'Player')), FOREIGN KEY (id_team) REFERENCES Team (id), - FOREIGN KEY (id_user) REFERENCES User (id) + FOREIGN KEY (id_user) REFERENCES Account (id) ); diff --git a/src/App/Controller/TeamController.php b/src/App/Controller/TeamController.php index b2c0ea9..e90ae67 100644 --- a/src/App/Controller/TeamController.php +++ b/src/App/Controller/TeamController.php @@ -4,6 +4,7 @@ namespace IQBall\App\Controller; use IQBall\App\Session\SessionHandle; use IQBall\App\ViewHttpResponse; +use IQBall\Core\Data\Account; use IQBall\Core\Http\HttpRequest; use IQBall\Core\Http\HttpResponse; use IQBall\Core\Model\TeamModel; @@ -107,6 +108,16 @@ class TeamController { return ViewHttpResponse::twig('display_teams.html.twig', ['teams' => $teams]); } + + public function deleteTeamByid(array $request,SessionHandle $session):HttpResponse{ + $a = $session->getAccount(); + if(isCoach($a->getEmail(),intval($request['idTeam']))){ + + } + return ; + } + + /** * @param int $id * @param SessionHandle $session diff --git a/src/Core/Gateway/TeamGateway.php b/src/Core/Gateway/TeamGateway.php index d775eda..925b625 100644 --- a/src/Core/Gateway/TeamGateway.php +++ b/src/Core/Gateway/TeamGateway.php @@ -81,5 +81,5 @@ class TeamGateway { )[0]['id'] ?? null; } - + public function isCoach(string $email,int $idTeam): } diff --git a/src/Core/Model/TeamModel.php b/src/Core/Model/TeamModel.php index f6af837..569b181 100644 --- a/src/Core/Model/TeamModel.php +++ b/src/Core/Model/TeamModel.php @@ -79,4 +79,7 @@ class TeamModel { return $teamId; } + public function isCoach($email,$idTeam): bool{ + + } }