API endpoints to delete customer/project/activity (#5181)
* added service methods with events to delete customer, project, activity * added API endpoints to delete customer, project, activity * added tests for new API endpoints
This commit is contained in:
@@ -240,6 +240,25 @@ final class ProjectController extends BaseApiController
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an existing project
|
||||
*
|
||||
* [DANGER] This will also delete ALL linked activities and timesheets.
|
||||
* Maybe use `PATCH` instead and mark it as inactive with `visible=false`?
|
||||
*/
|
||||
#[IsGranted('delete', 'project')]
|
||||
#[OA\Delete(responses: [new OA\Response(response: 204, description: 'Delete one project')])]
|
||||
#[OA\Parameter(name: 'id', description: 'Project ID to delete', in: 'path', required: true)]
|
||||
#[Route(path: '/{id}', name: 'delete_project', requirements: ['id' => '\d+'], methods: ['DELETE'])]
|
||||
public function deleteAction(Project $project): Response
|
||||
{
|
||||
$this->projectService->deleteProject($project);
|
||||
|
||||
$view = new View(null, Response::HTTP_NO_CONTENT);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of a meta-field for an existing project
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user