Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projet-cdaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Quentin Vrel
projet-cdaw
Commits
21f1f902
Commit
21f1f902
authored
Dec 03, 2020
by
Zohten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check
parent
56f97b7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
GameController.class.php
BackEnd/src/controller/GameController.class.php
+5
-0
gameRequest.http
BackEnd/src/testRequests/gameRequest.http
+20
-0
No files found.
BackEnd/src/controller/GameController.class.php
View file @
21f1f902
...
...
@@ -52,6 +52,11 @@ class GameController extends Controller
*/
protected
function
getAllGames
()
{
// Auth with token phase (id = 0 because not used when checking validtoken)
$authResponse
=
$this
->
authUser
(
-
1
,
'admin'
);
if
(
$authResponse
->
getCode
()
!=
200
){
return
$authResponse
;
}
$games
=
Game
::
getList
();
$response
=
Response
::
okResponse
(
json_encode
(
$games
,
JSON_PRETTY_PRINT
));
return
$response
;
...
...
BackEnd/src/testRequests/gameRequest.http
View file @
21f1f902
### Récupérer un token admin
POST http://localhost/index.php/login
{
"login": "admin",
"pwd": "hashedadminpwd"
}
### Récupérer un token utilisateur
POST http://localhost/index.php/login
{
"login": "testtest",
"pwd": "$2a$10$4AAhcsd4FpiPvUS718BemuGivzgRcsgxWbaSNdD.dK4wNwJAn.lQO"
}
### Récupérer toutes les games
GET http://localhost/index.php/game
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MDY5OTI4NzIsImV4cCI6MTYwNjk5NjQ3MiwiaXNzIjoibG9jYWxob3N0IiwiZGF0YSI6eyJpZCI6IjciLCJyb2xlIjoiMiIsImVtYWlsIjoiYmVsb3ZlZC5hZG1pbkBmcmVlLmZyIn19.pDqIGydCz5AtOInm8QDcpQ29GiQtN2Hq7LgyYWqUaa4
### Récupérer la game avec id 3
### TODO : check if user is in the game
GET http://localhost/index.php/game/3
### Récupérer toutes les games publiques
GET http://localhost/index.php/game/public
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MDY5OTI5NDgsImV4cCI6MTYwNjk5NjU0OCwiaXNzIjoibG9jYWxob3N0IiwiZGF0YSI6eyJpZCI6IjgiLCJyb2xlIjoiMSIsImVtYWlsIjoidGVzdEBmcmVlLmZyIn19.f75qyLwTfjOB75vFgrwp5iZe1SgJnVULjC9jq642Vis
### Ouverture d'une game
POST http://localhost/index.php/game
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MDY5OTI5NDgsImV4cCI6MTYwNjk5NjU0OCwiaXNzIjoibG9jYWxob3N0IiwiZGF0YSI6eyJpZCI6IjgiLCJyb2xlIjoiMSIsImVtYWlsIjoidGVzdEBmcmVlLmZyIn19.f75qyLwTfjOB75vFgrwp5iZe1SgJnVULjC9jq642Vis
{
"is_private": "0"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment