Skip to content

Commit

Permalink
- Deletion of appointment participations was added
Browse files Browse the repository at this point in the history
- Rename methode `viewings` to `createViewing`
  • Loading branch information
doishub committed Sep 2, 2022
1 parent 1c8beac commit bf1df97
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/Controller/Api/RoutingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public function notes(): JsonResponse
*
* @Route("/events/{id}/{module}", name="events")
*/
public function events(/*mixed*/ $id = null, ?string $module = null): JsonResponse
public function events(/*mixed*/ $id = null, /*string|int|null*/ $module = null): JsonResponse
{
$request = $this->requestStack->getCurrentRequest();
$parameters = $request->query->all();
Expand All @@ -408,10 +408,16 @@ public function events(/*mixed*/ $id = null, ?string $module = null): JsonRespon
return $objEvents->read($parameters);

case PropstackController::METHOD_CREATE:
// Create viewings
// Create viewing
if('viewings' === $module && null !== $id)
{
return $objEvents->viewings($id, $parameters);
return $objEvents->createViewing($id, $parameters);
}
case PropstackController::METHOD_DELETE:
// Delete viewing
if(is_integer($module) && null !== $id)
{
return $objEvents->deleteViewing($id, $module);
}
}

Expand Down
17 changes: 16 additions & 1 deletion src/Controller/Event/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function read(array $parameters)
/**
* Set Participants to a specific event
*/
public function viewings($id, array $parameters)
public function createViewing($id, array $parameters)
{
// Add id and viewings to route
$this->addRoutePath($id);
Expand All @@ -50,6 +50,21 @@ public function viewings($id, array $parameters)
return $this->getResponse();
}

/**
* Delete Participants from a specific event
*/
public function deleteViewing($eventId, $viewingId)
{
// Add id and viewings to route
$this->addRoutePath($eventId);
$this->addRoutePath('viewings');
$this->addRoutePath($viewingId);

$this->call([],self::METHOD_DELETE);

return $this->getResponse();
}

/**
* @inheritDoc
*/
Expand Down

0 comments on commit bf1df97

Please sign in to comment.