Commit a92a0e42 authored by Zohten's avatar Zohten

better than select *

parent d52161c9
...@@ -19,11 +19,17 @@ class RoundController extends Controller ...@@ -19,11 +19,17 @@ class RoundController extends Controller
switch ($httpMethod) { switch ($httpMethod) {
case 'GET': case 'GET':
// If there is a uriParams, it is the /round/{id} endpoint // If there is a uriParams, it is the /round/{id} or /round/{id}/user endpoint
if ($uriParams) { if ($uriParams) {
$lenUriParams = count($uriParams);
// Check if it is the /round/{id}/user endpoint
if (($lenUriParams == 2) && ($uriParams[1]=='user')) {
return $this->getUsersInRound($uriParams[0]); return $this->getUsersInRound($uriParams[0]);
} }
// Else, it is the /round endpoint // Nope, it is the /round/{id} endpoint
return $this->getRound($uriParams[0]);
}
// If there is no uriParams, it is the /round endpoint
return $this->getAllRounds(); return $this->getAllRounds();
break; break;
} }
......
...@@ -12,7 +12,15 @@ Game::addSqlQuery( ...@@ -12,7 +12,15 @@ Game::addSqlQuery(
Game::addSqlQuery( Game::addSqlQuery(
'ROUND_GET_USERS', 'ROUND_GET_USERS',
'SELECT * 'SELECT usr.ID_USER,
usr.ID_ROLE,
usr.LOGIN,
usr.AVATAR,
usr.LASTNAME,
usr.FIRSTNAME,
usr.MAIL,
usr.BAN_ACCOUNT,
usr.LAST_IP
FROM MJ_USER as usr FROM MJ_USER as usr
JOIN MJ_PLAY as p on p.ID_USER = usr.ID_USER JOIN MJ_PLAY as p on p.ID_USER = usr.ID_USER
JOIN MJ_ROUND as r on r.ID_ROUND = p.ID_ROUND JOIN MJ_ROUND as r on r.ID_ROUND = p.ID_ROUND
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment