Fix(OgRepository): fix repo deletion payload mismatch and error handling
parent
7df739c17f
commit
cd1f7c0f23
|
|
@ -15,11 +15,15 @@ class DeleteAction extends AbstractOgRepositoryController
|
|||
{
|
||||
public function __invoke(ImageRepository $repository, DeleteRepositoryInput $input): JsonResponse
|
||||
{
|
||||
$content = $this->createRequest('DELETE', 'http://'.$repository->getIp().':8006/ogrepository/v1/git/repositories/'.$input->repository, [
|
||||
if (empty($input->repositoryName)) {
|
||||
throw new BadRequestHttpException('Repository name is required');
|
||||
}
|
||||
|
||||
$content = $this->createRequest('DELETE', 'http://'.$repository->getIp().':8006/ogrepository/v1/git/repositories/'.$input->repositoryName, [
|
||||
]);
|
||||
|
||||
if (isset($content['error']) && $content['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
|
||||
throw new BadRequestHttpException('Error deleting repository');
|
||||
if (isset($content['error'])) {
|
||||
throw new BadRequestHttpException($content['details'] ?? $content['error']);
|
||||
}
|
||||
|
||||
return new JsonResponse(data: [], status: Response::HTTP_OK);
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ final class DeleteRepositoryInput
|
|||
{
|
||||
#[Groups(['image-image-repository:write'])]
|
||||
#[ApiProperty(description: 'The repository name', example: "")]
|
||||
public ?string $repository = null;
|
||||
public ?string $repositoryName = null;
|
||||
}
|
||||
Loading…
Reference in New Issue