Skip to content

Commit

Permalink
test2
Browse files Browse the repository at this point in the history
  • Loading branch information
KotsiosDimis committed Dec 27, 2024
1 parent 84b3466 commit 0539f17
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions blokus.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,17 @@ public function routeRequest($input) {
$createdAt = date('Y-m-d H:i:s');*/

//Issue with parameters
$router->add('GET', 'lobbys/create', function($input) { //Figure out how we can test this one
/*$router->add('GET', 'lobbys/create', function($input) { //Figure out how we can test this one
if (isset($input['player1_id']) && is_numeric($input['player1_id'])) {
createLobby((int)$input['player1_id']);
} else {
echo json_encode(['error' => 'Invalid or missing userid parameter.']);
}
});
});*/

$router->add('POST', 'lobbys/create', function($input) { //Figure out how we can test this one too
createLobby((int)$input['userId'], $input['gameType'], (int)$input['maxPlayers'], $input['createdAt']);
});

/*$router->add('POST', 'lobbys/join', function($input) { //Figure out how we can test this one too
if (isset($input['userId']) && isset($input['lobbyId'])) {
Expand All @@ -130,9 +134,7 @@ public function routeRequest($input) {
}
});*/

$router->add('POST', 'lobbys/join', function($input) { //Figure out how we can test this one too
createLobby((int)$input['userId'], $input['gameType'], (int)$input['maxPlayers'], $input['createdAt']);
});


// //works
$router->add('POST', 'lobbys/leave', function() {
Expand Down

0 comments on commit 0539f17

Please sign in to comment.