90682e809c
LST-68 (2.6) backend. Behaviour-preserving move of the external integrations into src/Module/Integration/. All 26 routes and securities unchanged. - 5 entities (4 *Configuration singletons + TaskBookStackLink) + 5 repositories (Domain interfaces + Doctrine impls, bound). TaskBookStackLink.task now references TaskInterface (contract). - Domain (FileSource interface, SharePathResolver, share DTOs + exceptions); Infrastructure (GiteaApiService, BookStackApiService, SmbFileSource, 15 ApiResources, 21 State, 4 Share controllers). - Cross-module couplings via abstractions: CalDavService (PM) injects ZimbraConfigurationRepositoryInterface; PM TaskDocument consumers repointed to the module's FileSource/SharePathResolver; Gitea/BookStack State load tasks via TaskRepositoryInterface (concrete Project read for integration fields — documented). ZimbraTestConnection keeps CalDavService (no build cycle). TokenEncryptor stays shared. - IntegrationModule registered; doctrine mapping added. - #[Auditable] + Timestampable on the 4 Configuration entities (additive migration on the 4 *_configuration tables). 163 tests green, container compiles (no cycle), no route regression, cs-fixer clean.
43 lines
1.5 KiB
PHP
43 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Module\Integration\Infrastructure\ApiPlatform\State;
|
|
|
|
use ApiPlatform\Metadata\Operation;
|
|
use ApiPlatform\State\ProviderInterface;
|
|
use App\Module\Integration\Infrastructure\ApiPlatform\Resource\GiteaBranchName;
|
|
use App\Module\Integration\Infrastructure\Service\GiteaApiService;
|
|
use App\Module\ProjectManagement\Domain\Repository\TaskRepositoryInterface;
|
|
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|
|
|
final readonly class GiteaBranchNameProvider implements ProviderInterface
|
|
{
|
|
/** @see GiteaBranchProcessor::ALLOWED_TYPES */
|
|
private const array ALLOWED_TYPES = ['feature', 'fix', 'refactor', 'hotfix', 'chore'];
|
|
|
|
public function __construct(
|
|
private GiteaApiService $giteaApiService,
|
|
private TaskRepositoryInterface $taskRepository,
|
|
) {}
|
|
|
|
public function provide(Operation $operation, array $uriVariables = [], array $context = []): GiteaBranchName
|
|
{
|
|
$task = $this->taskRepository->findById((int) ($uriVariables['taskId'] ?? 0));
|
|
if (null === $task) {
|
|
throw new NotFoundHttpException('Task not found.');
|
|
}
|
|
|
|
$type = $uriVariables['type'] ?? 'feature';
|
|
if (!in_array($type, self::ALLOWED_TYPES, true)) {
|
|
throw new BadRequestHttpException('Invalid branch type.');
|
|
}
|
|
|
|
$dto = new GiteaBranchName();
|
|
$dto->name = $this->giteaApiService->generateBranchName($task, $type);
|
|
|
|
return $dto;
|
|
}
|
|
}
|