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
77495ef5
Commit
77495ef5
authored
Dec 01, 2020
by
Zohten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added a way to update actions
parent
9911b38f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
2 deletions
+36
-2
RoundController.class.php
BackEnd/src/controller/RoundController.class.php
+24
-1
Round.class.php
BackEnd/src/model/Round.class.php
+5
-0
Round.sql.php
BackEnd/src/sql/Round.sql.php
+7
-1
No files found.
BackEnd/src/controller/RoundController.class.php
View file @
77495ef5
...
@@ -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
*
* @param string $action string containing all actions
* @return Response
*/
protected
function
updateActions
(
$action
)
{
//print_r($action); die('bite');
Round
::
updateActions
(
$action
);
$message
=
json_encode
([
"message"
=>
'Actions updated!'
]);
$response
=
Response
::
createdResponse
(
$message
);
return
$response
;
}
}
}
\ No newline at end of file
BackEnd/src/model/Round.class.php
View file @
77495ef5
...
@@ -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 @
77495ef5
...
@@ -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
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