visgraph: adding endpoint to get list of relations

This commit is contained in:
Mathieu Jaumotte 2021-11-02 09:49:47 +01:00
parent d06a4b1ca9
commit bd2ee9ddc1
4 changed files with 47 additions and 5 deletions

View File

@ -900,7 +900,28 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
]
],
]
]
],
[
'class' => \Chill\PersonBundle\Entity\Relationships\Relation::class,
'controller' => \Chill\PersonBundle\Controller\RelationshipApiController::class,
'name' => 'relations',
'base_path' => '/api/1.0/relations/relation',
'base_role' => 'ROLE_USER',
'actions' => [
'_index' => [
'methods' => [
Request::METHOD_GET => true,
Request::METHOD_HEAD => true
],
],
'_entity' => [
'methods' => [
Request::METHOD_GET => true,
Request::METHOD_HEAD => true
]
],
]
],
]
]);
}

View File

@ -20,6 +20,7 @@ class Relation
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Serializer\Groups({"read"})
*/
private ?int $id = null;

View File

@ -110,6 +110,14 @@ const getRelationshipsByPerson = (person) => {
`/api/1.0/relations/relationship/by-person/${person._id}.json`)
}
/**
* Return list of relations
* @returns {Promise<Response>}
*/
const getRelationsList = () => {
return getFetch(`/api/1.0/relations/relation.json`)
}
/**
* @function postRelationship
* @param person
@ -132,5 +140,6 @@ export {
getHouseholdByPerson,
getCoursesByPerson,
getRelationshipsByPerson,
postRelationship
getRelationsList,
postRelationship,
}

View File

@ -307,7 +307,7 @@ components:
- $ref: "#/components/schemas/RelationById"
reverse:
type: boolean
paths:
/1.0/person/person/{id}.json:
@ -1093,7 +1093,7 @@ paths:
description: "OK"
400:
description: "transition cannot be applyed"
/1.0/person/accompanying-course/by-person/{person_id}.json:
get:
tags:
@ -1647,7 +1647,7 @@ paths:
description: "OK"
400:
description: "Bad Request"
/1.0/relations/relationship.json:
post:
tags:
@ -1671,3 +1671,14 @@ paths:
description: "Unauthorized"
422:
description: "Invalid data: the data is a valid json, could be deserialized, but does not pass validation"
/1.0/relations/relation.json:
get:
tags:
- relationships
summary: get a list of relations
responses:
401:
description: "Unauthorized"
200:
description: "OK"