add vote action started, changed some routes
This commit is contained in:
parent
d1dd8955a3
commit
216d1902cc
|
@ -46,7 +46,7 @@ class DefaultController extends AbstractController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Get(
|
* @Get(
|
||||||
* path = "/poll/all",
|
* path = "/polls",
|
||||||
* name = "get_all_polls"
|
* name = "get_all_polls"
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
@ -64,7 +64,7 @@ class DefaultController extends AbstractController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Post(
|
* @Post(
|
||||||
* path = "/poll/new",
|
* path = "/poll",
|
||||||
* name = "new_polls",
|
* name = "new_polls",
|
||||||
* requirements = {"creator"="\w+"}
|
* requirements = {"creator"="\w+"}
|
||||||
* )
|
* )
|
||||||
|
@ -125,7 +125,7 @@ class DefaultController extends AbstractController {
|
||||||
* @Get(
|
* @Get(
|
||||||
* path = "/poll/{id}/comments",
|
* path = "/poll/{id}/comments",
|
||||||
* name = "get_poll_comment",
|
* name = "get_poll_comment",
|
||||||
* requirements = {"id"="\d+"}
|
* requirements = {"poll_id"="\d+"}
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function getPollCommentsAction( Poll $poll ) {
|
public function getPollCommentsAction( Poll $poll ) {
|
||||||
|
@ -140,7 +140,7 @@ class DefaultController extends AbstractController {
|
||||||
* @Get(
|
* @Get(
|
||||||
* path = "/poll/{id}",
|
* path = "/poll/{id}",
|
||||||
* name = "get_poll",
|
* name = "get_poll",
|
||||||
* requirements = {"id"="\d+"}
|
* requirements = {"poll_id"="\d+"}
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function getPollConfig( Poll $poll ) {
|
public function getPollConfig( Poll $poll ) {
|
||||||
|
@ -160,13 +160,14 @@ class DefaultController extends AbstractController {
|
||||||
*/
|
*/
|
||||||
public function updatePollConfig( Poll $poll, Request $request ) {
|
public function updatePollConfig( Poll $poll, Request $request ) {
|
||||||
|
|
||||||
|
// TODO check validity of request
|
||||||
|
// update only if we have the admin key
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$em->persist( $poll );
|
$em->persist( $poll );
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
return $this->json( [
|
return $this->json( [
|
||||||
'message' => 'you updated the poll',
|
'message' => 'you updated the poll ' . $poll->getTitle(),
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,6 +215,13 @@ class DefaultController extends AbstractController {
|
||||||
201 );
|
201 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function newVoteAction( Poll $poll ) {
|
||||||
|
return $this->json( [
|
||||||
|
'message' => 'you voted on the poll',
|
||||||
|
],
|
||||||
|
201 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Delete(
|
* @Delete(
|
||||||
|
|
Loading…
Reference in New Issue