diff --git a/src/Controller/OgAgent/GetGitDataAction.php b/src/Controller/OgAgent/GetGitDataAction.php new file mode 100644 index 0000000..97d29e6 --- /dev/null +++ b/src/Controller/OgAgent/GetGitDataAction.php @@ -0,0 +1,39 @@ + 'GetGitData', + 'dsk' => (string) $input->partition->getEntity()->getDiskNumber(), + 'par' => (string) $input->partition->getEntity()->getPartitionNumber(), + ]; + + + $response = $this->createRequest( + method: 'POST', + url: 'https://'.$input->client->getEntity()->getIp().':8000/opengnsys/GetGitData', + params: [ + 'json' => $data, + ], + token: $input->client->getEntity()->getToken(), + ); + + $parsedResponse = [ + 'branch' => $response['branch'] ?? null, + 'repo' => $response['repo'] ?? null, + ]; + + return new JsonResponse(data: $parsedResponse, status: Response::HTTP_OK); + } +} \ No newline at end of file diff --git a/src/Controller/OgRepository/Git/CreateBranchAction.php b/src/Controller/OgRepository/Git/CreateBranchAction.php new file mode 100644 index 0000000..00c8d96 --- /dev/null +++ b/src/Controller/OgRepository/Git/CreateBranchAction.php @@ -0,0 +1,36 @@ +createRequest('POST', 'http://'.$repository->getIp().':8006/ogrepository/v1/git/repositories/'.$input->repository.'/branches', [ + 'json' => [ + 'name' => $input->name, + 'commit' => $input->commit, + ] + ]); + + if (isset($content['error']) && $content['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) { + throw new BadRequestHttpException('Error creating branch'); + } + + return new JsonResponse(data: [], status: Response::HTTP_OK); + } +} \ No newline at end of file diff --git a/src/Dto/Input/CreateBranchInput.php b/src/Dto/Input/CreateBranchInput.php new file mode 100644 index 0000000..48c4dce --- /dev/null +++ b/src/Dto/Input/CreateBranchInput.php @@ -0,0 +1,21 @@ +