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
3519cc8d
Commit
3519cc8d
authored
Dec 01, 2020
by
quentin.vrel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gvipers.imt-lille-douai.fr/QVrel/projet-cdaw
parents
206d4e6f
7f257120
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
4 deletions
+48
-4
RoundController.class.php
BackEnd/src/controller/RoundController.class.php
+24
-1
UserController.class.php
BackEnd/src/controller/UserController.class.php
+1
-1
Round.class.php
BackEnd/src/model/Round.class.php
+5
-0
Round.sql.php
BackEnd/src/sql/Round.sql.php
+7
-1
gameRequest.http
BackEnd/src/testRequests/gameRequest.http
+5
-0
roundRequests.http
BackEnd/src/testRequests/roundRequests.http
+6
-1
No files found.
BackEnd/src/controller/RoundController.class.php
View file @
3519cc8d
...
@@ -36,6 +36,16 @@ class RoundController extends Controller
...
@@ -36,6 +36,16 @@ class RoundController extends Controller
$body
=
$this
->
request
->
getData
();
$body
=
$this
->
request
->
getData
();
return
$this
->
newRound
(
$body
);
return
$this
->
newRound
(
$body
);
break
;
break
;
case
'PUT'
:
// If there is a uriParams, it is the /round/{id}/action endpoint
if
(
$uriParams
)
{
$lenUriParams
=
count
(
$uriParams
);
if
((
$lenUriParams
==
2
)
&&
(
$uriParams
[
1
]
==
'action'
))
{
$body
=
$this
->
request
->
getData
();
return
$this
->
updateActions
(
array_merge
(
$body
,
[
'id'
=>
$uriParams
[
0
]]));
}
}
break
;
}
}
$message
=
json_encode
([
"message"
=>
"unsupported parameters or method in round"
]);
$message
=
json_encode
([
"message"
=>
"unsupported parameters or method in round"
]);
return
Response
::
errorResponse
(
$message
);
return
Response
::
errorResponse
(
$message
);
...
@@ -91,5 +101,18 @@ class RoundController extends Controller
...
@@ -91,5 +101,18 @@ class RoundController extends Controller
return
$response
;
return
$response
;
}
}
/**
* (PUT) Add action of the round in Round table
* TODO : ADD MAIN LOGIC FOR THE GAME
*
* @param string $action string containing all actions
* @return Response
*/
protected
function
updateActions
(
$action
)
{
Round
::
updateActions
(
$action
);
$message
=
json_encode
([
"message"
=>
'Actions updated!'
]);
$response
=
Response
::
createdResponse
(
$message
);
return
$response
;
}
}
}
\ No newline at end of file
BackEnd/src/controller/UserController.class.php
View file @
3519cc8d
...
@@ -119,7 +119,7 @@ class UserController extends Controller
...
@@ -119,7 +119,7 @@ class UserController extends Controller
protected
function
updateUser
(
$array
)
protected
function
updateUser
(
$array
)
{
{
// Auth with token phase
// Auth with token phase
$authResponse
=
$this
->
authUser
(
$
id
);
$authResponse
=
$this
->
authUser
(
$
array
[
'id'
]
);
if
(
$authResponse
->
getCode
()
!=
200
){
if
(
$authResponse
->
getCode
()
!=
200
){
return
$authResponse
;
return
$authResponse
;
}
}
...
...
BackEnd/src/model/Round.class.php
View file @
3519cc8d
...
@@ -34,4 +34,9 @@ class Round extends Model
...
@@ -34,4 +34,9 @@ class Round extends Model
$stm
=
parent
::
exec
(
'ROUND_CREATE'
,
$pimped_array
);
$stm
=
parent
::
exec
(
'ROUND_CREATE'
,
$pimped_array
);
}
}
public
static
function
updateActions
(
$array
)
{
$stm
=
parent
::
exec
(
'ACTION_UPDATE'
,
$array
);
}
}
}
\ No newline at end of file
BackEnd/src/sql/Round.sql.php
View file @
3519cc8d
...
@@ -27,8 +27,14 @@ Game::addSqlQuery(
...
@@ -27,8 +27,14 @@ Game::addSqlQuery(
WHERE r.ID_ROUND=:id'
WHERE r.ID_ROUND=:id'
);
);
User
::
addSqlQuery
(
Game
::
addSqlQuery
(
'ROUND_CREATE'
,
'ROUND_CREATE'
,
'INSERT INTO MJ_ROUND (ID_ROUND ,ID_GAME ,PREVAILING_WIND ,SEED ,BEGINING ,ENDING ,ACTIONS)
'INSERT INTO MJ_ROUND (ID_ROUND ,ID_GAME ,PREVAILING_WIND ,SEED ,BEGINING ,ENDING ,ACTIONS)
VALUES (NULL, :id_game, :prevailing_wind, :seed, :begin_date, NULL, NULL)'
VALUES (NULL, :id_game, :prevailing_wind, :seed, :begin_date, NULL, NULL)'
);
);
Game
::
addSqlQuery
(
'ACTION_UPDATE'
,
'UPDATE MJ_ROUND
SET ACTIONS = :actions WHERE ID_ROUND = :id'
);
\ No newline at end of file
BackEnd/src/testRequests/gameRequest.http
0 → 100644
View file @
3519cc8d
### Récupérer toutes les games
GET http://localhost/index.php/game
### Récupérer la game avec id 3
GET http://localhost/index.php/game/3
\ No newline at end of file
BackEnd/src/testRequests/roundRequests.http
View file @
3519cc8d
...
@@ -17,3 +17,8 @@ POST http://localhost/index.php/round
...
@@ -17,3 +17,8 @@ POST http://localhost/index.php/round
}
}
###
###
PUT http://localhost/index.php/round/1/action
{
"actions": "test"
}
\ No newline at end of file
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