mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add endpoint for listing evaluation
This commit is contained in:
parent
ebb2479966
commit
7045e643a8
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
|
use Chill\MainBundle\Serializer\Model\Collection;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||||
|
|
||||||
|
class SocialWorkEvaluationApiController extends AbstractController
|
||||||
|
{
|
||||||
|
private PaginatorFactory $paginatorFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PaginatorFactory $paginatorFactory
|
||||||
|
*/
|
||||||
|
public function __construct(PaginatorFactory $paginatorFactory)
|
||||||
|
{
|
||||||
|
$this->paginatorFactory = $paginatorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/api/1.0/person/social-work/evaluation/by-social-action/{action_id}.json",
|
||||||
|
* name="chill_person_evaluation_index_by_social_action",
|
||||||
|
* requirements={
|
||||||
|
* "_format": "json"
|
||||||
|
* }
|
||||||
|
* )
|
||||||
|
* @ParamConverter("action", options={"id": "action_id"})
|
||||||
|
* @param SocialAction $action
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function listEvaluationBySocialAction(SocialAction $action): Response
|
||||||
|
{
|
||||||
|
$pagination = $this->paginatorFactory->create($action->getEvaluations()->count());
|
||||||
|
|
||||||
|
$evaluations = $action->getEvaluations()->slice($pagination->getCurrentPageFirstItemNumber(),
|
||||||
|
$pagination->getItemsPerPage());
|
||||||
|
$collection = new Collection($evaluations, $pagination);
|
||||||
|
|
||||||
|
return $this->json($collection, Response::HTTP_OK, [], [ 'groups' => [ 'read' ]]);
|
||||||
|
}
|
||||||
|
}
|
@ -217,7 +217,7 @@ components:
|
|||||||
type: integer
|
type: integer
|
||||||
type:
|
type:
|
||||||
type: string
|
type: string
|
||||||
enum:
|
enum:
|
||||||
- 'accompanying_period_work'
|
- 'accompanying_period_work'
|
||||||
note:
|
note:
|
||||||
type: string
|
type: string
|
||||||
@ -296,7 +296,7 @@ paths:
|
|||||||
$ref: "#/components/schemas/Person"
|
$ref: "#/components/schemas/Person"
|
||||||
403:
|
403:
|
||||||
description: "Unauthorized"
|
description: "Unauthorized"
|
||||||
|
|
||||||
/1.0/person/person.json:
|
/1.0/person/person.json:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@ -1035,7 +1035,7 @@ paths:
|
|||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- person
|
- person
|
||||||
summary: Return a list of all origins
|
summary: Return a list of all origins
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: "ok"
|
description: "ok"
|
||||||
@ -1043,7 +1043,7 @@ paths:
|
|||||||
/1.0/person/accompanying-period/origin/{id}.json:
|
/1.0/person/accompanying-period/origin/{id}.json:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- person
|
- person
|
||||||
summary: Return an origin by id
|
summary: Return an origin by id
|
||||||
parameters:
|
parameters:
|
||||||
- name: id
|
- name: id
|
||||||
@ -1257,7 +1257,7 @@ paths:
|
|||||||
/1.0/person/social/social-action.json:
|
/1.0/person/social/social-action.json:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- accompanying-course-work
|
- social-work-social-action
|
||||||
summary: get a list of social action
|
summary: get a list of social action
|
||||||
responses:
|
responses:
|
||||||
401:
|
401:
|
||||||
@ -1268,7 +1268,7 @@ paths:
|
|||||||
/1.0/person/social/social-action/{id}.json:
|
/1.0/person/social/social-action/{id}.json:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- accompanying-course-work
|
- social-work-social-action
|
||||||
parameters:
|
parameters:
|
||||||
- name: id
|
- name: id
|
||||||
in: path
|
in: path
|
||||||
@ -1291,7 +1291,7 @@ paths:
|
|||||||
/1.0/person/social/social-action/by-social-issue/{id}.json:
|
/1.0/person/social/social-action/by-social-issue/{id}.json:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- accompanying-course-work
|
- social-work-social-action
|
||||||
parameters:
|
parameters:
|
||||||
- name: id
|
- name: id
|
||||||
in: path
|
in: path
|
||||||
@ -1311,6 +1311,25 @@ paths:
|
|||||||
400:
|
400:
|
||||||
description: "Bad Request"
|
description: "Bad Request"
|
||||||
|
|
||||||
|
/1.0/person/social-work/evaluation/by-social-action/{social_action_id}.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- social-work-evaluation
|
||||||
|
summary: return a list of evaluation which are available for a given social action
|
||||||
|
parameters:
|
||||||
|
- name: social_action_id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The social action's id
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: integer
|
||||||
|
minimum: 1
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: ok
|
||||||
|
404:
|
||||||
|
description: not found
|
||||||
|
|
||||||
|
|
||||||
/1.0/person/social-work/social-issue.json:
|
/1.0/person/social-work/social-issue.json:
|
||||||
@ -1321,7 +1340,7 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: "ok"
|
description: "ok"
|
||||||
|
|
||||||
/1.0/person/social-work/social-issue/{id}.json:
|
/1.0/person/social-work/social-issue/{id}.json:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@ -1347,7 +1366,7 @@ paths:
|
|||||||
description: "not found"
|
description: "not found"
|
||||||
401:
|
401:
|
||||||
description: "Unauthorized"
|
description: "Unauthorized"
|
||||||
|
|
||||||
/1.0/person/social-work/result.json:
|
/1.0/person/social-work/result.json:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user