From e1a9fd919bafd4b67ebf1b52a7c5ae46e966d58c Mon Sep 17 00:00:00 2001 From: JonasVHG <4658984+JonasVHG@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:23:42 +0200 Subject: [PATCH] rename uiTdatabankOrganizer to UdbOrganizer --- .../Integrations/Controllers/IntegrationController.php | 10 +++++----- app/Domain/Integrations/Integration.php | 6 +++--- .../Mappers/UiTdatabankOrganizerMapper.php | 8 ++++---- .../Integrations/Models/UiTdatabankOrganizerModel.php | 6 +++--- .../EloquentUiTdatabankOrganizerRepository.php | 6 +++--- .../Repositories/UiTdatabankOrganizerRepository.php | 6 +++--- .../{UiTdatabankOrganizer.php => UdbOrganizer.php} | 2 +- app/Nova/Actions/ActivateUitpasIntegration.php | 4 ++-- app/Nova/Actions/AddUiTdatabankOrganizer.php | 4 ++-- 9 files changed, 26 insertions(+), 26 deletions(-) rename app/Domain/Integrations/{UiTdatabankOrganizer.php => UdbOrganizer.php} (86%) diff --git a/app/Domain/Integrations/Controllers/IntegrationController.php b/app/Domain/Integrations/Controllers/IntegrationController.php index 67ed0049d..f25cf064c 100644 --- a/app/Domain/Integrations/Controllers/IntegrationController.php +++ b/app/Domain/Integrations/Controllers/IntegrationController.php @@ -33,7 +33,7 @@ use App\Domain\Integrations\Mappers\UpdateContactInfoMapper; use App\Domain\Integrations\Mappers\UpdateIntegrationMapper; use App\Domain\Integrations\Mappers\UpdateIntegrationUrlsMapper; -use App\Domain\Integrations\UiTdatabankOrganizer; +use App\Domain\Integrations\UdbOrganizer; use App\Domain\Integrations\Repositories\IntegrationRepository; use App\Domain\Integrations\Repositories\IntegrationUrlRepository; use App\Domain\Integrations\Repositories\UiTdatabankOrganizerRepository; @@ -297,10 +297,10 @@ public function updateOrganizers(string $integrationId, UpdateIntegrationUiTdata { $integration = $this->integrationRepository->getById(Uuid::fromString($integrationId)); - $organizerIds = collect($integration->uiTdatabankOrganizers())->map(fn (UiTdatabankOrganizer $organizer) => $organizer->organizerId); + $organizerIds = collect($integration->uiTdatabankOrganizers())->map(fn (UdbOrganizer $organizer) => $organizer->organizerId); $newOrganizers = array_filter( UiTdatabankOrganizerMapper::mapUpdateOrganizers($request, $integrationId), - fn (UiTdatabankOrganizer $organizer) => !in_array($organizer->organizerId, $organizerIds->toArray(), true) + fn (UdbOrganizer $organizer) => !in_array($organizer->organizerId, $organizerIds->toArray(), true) ); $this->organizerRepository->create(...$newOrganizers); @@ -310,7 +310,7 @@ public function updateOrganizers(string $integrationId, UpdateIntegrationUiTdata public function deleteOrganizer(string $integrationId, string $organizerId): RedirectResponse { - $this->organizerRepository->delete(new UiTdatabankOrganizer( + $this->organizerRepository->delete(new UdbOrganizer( Uuid::uuid4(), Uuid::fromString($integrationId), $organizerId @@ -404,7 +404,7 @@ private function guardUserIsContact(Request $request, string $integrationId): ?R public function getIntegrationOrganizersWithTestOrganizer(Integration $integration): Collection { - $organizerIds = collect($integration->uiTdatabankOrganizers())->map(fn (UiTdatabankOrganizer $organizer) => $organizer->organizerId); + $organizerIds = collect($integration->uiTdatabankOrganizers())->map(fn (UdbOrganizer $organizer) => $organizer->organizerId); $uitpasOrganizers = $this->searchClient->findUiTPASOrganizers(...$organizerIds)->getMember()?->getItems(); $organizers = collect($uitpasOrganizers)->map(function (SapiOrganizer $organizer) { diff --git a/app/Domain/Integrations/Integration.php b/app/Domain/Integrations/Integration.php index 397343ce6..3ce401d92 100644 --- a/app/Domain/Integrations/Integration.php +++ b/app/Domain/Integrations/Integration.php @@ -31,7 +31,7 @@ final class Integration private ?Organization $organization; - /** @var array */ + /** @var array */ private array $uiTdatabankOrganizers; /** @var array */ @@ -126,7 +126,7 @@ public function withKeycloakClients(KeycloakClient ...$keycloakClients): self return $clone; } - public function withUiTdatabankOrganizers(UiTdatabankOrganizer ...$organizers): self + public function withUiTdatabankOrganizers(UdbOrganizer ...$organizers): self { $clone = clone $this; $clone->uiTdatabankOrganizers = $organizers; @@ -178,7 +178,7 @@ public function organization(): ?Organization } /** - * @return array + * @return array */ public function uiTdatabankOrganizers(): array { diff --git a/app/Domain/Integrations/Mappers/UiTdatabankOrganizerMapper.php b/app/Domain/Integrations/Mappers/UiTdatabankOrganizerMapper.php index 6e25ffeb9..b022fe72f 100644 --- a/app/Domain/Integrations/Mappers/UiTdatabankOrganizerMapper.php +++ b/app/Domain/Integrations/Mappers/UiTdatabankOrganizerMapper.php @@ -6,24 +6,24 @@ use App\Domain\Integrations\FormRequests\RequestActivationRequest; use App\Domain\Integrations\FormRequests\UpdateIntegrationUiTdatabankOrganizersRequest; -use App\Domain\Integrations\UiTdatabankOrganizer; +use App\Domain\Integrations\UdbOrganizer; use Illuminate\Http\Request; use Ramsey\Uuid\Uuid; final class UiTdatabankOrganizerMapper { /** - * @return UiTdatabankOrganizer[] + * @return UdbOrganizer[] */ public static function map(Request $request, string $id): array { /** - * @var UiTdatabankOrganizer[] $organizers + * @var UdbOrganizer[] $organizers */ $organizers = []; foreach ($request->input('organizers') ?? [] as $organizer) { - $organizers[] = new UiTdatabankOrganizer( + $organizers[] = new UdbOrganizer( Uuid::uuid4(), Uuid::fromString($id), $organizer['id'] diff --git a/app/Domain/Integrations/Models/UiTdatabankOrganizerModel.php b/app/Domain/Integrations/Models/UiTdatabankOrganizerModel.php index 915edc998..90c6215fb 100644 --- a/app/Domain/Integrations/Models/UiTdatabankOrganizerModel.php +++ b/app/Domain/Integrations/Models/UiTdatabankOrganizerModel.php @@ -4,7 +4,7 @@ namespace App\Domain\Integrations\Models; -use App\Domain\Integrations\UiTdatabankOrganizer; +use App\Domain\Integrations\UdbOrganizer; use App\Models\UuidModel; use Ramsey\Uuid\Uuid; @@ -18,9 +18,9 @@ final class UiTdatabankOrganizerModel extends UuidModel 'organizer_id', ]; - public function toDomain(): UiTdatabankOrganizer + public function toDomain(): UdbOrganizer { - return new UiTdatabankOrganizer( + return new UdbOrganizer( Uuid::fromString($this->id), Uuid::fromString($this->integration_id), $this->organizer_id, diff --git a/app/Domain/Integrations/Repositories/EloquentUiTdatabankOrganizerRepository.php b/app/Domain/Integrations/Repositories/EloquentUiTdatabankOrganizerRepository.php index 2b6d4839d..0fc5536c3 100644 --- a/app/Domain/Integrations/Repositories/EloquentUiTdatabankOrganizerRepository.php +++ b/app/Domain/Integrations/Repositories/EloquentUiTdatabankOrganizerRepository.php @@ -5,12 +5,12 @@ namespace App\Domain\Integrations\Repositories; use App\Domain\Integrations\Models\UiTdatabankOrganizerModel; -use App\Domain\Integrations\UiTdatabankOrganizer; +use App\Domain\Integrations\UdbOrganizer; use Illuminate\Support\Facades\DB; final class EloquentUiTdatabankOrganizerRepository implements UiTdatabankOrganizerRepository { - public function create(UiTdatabankOrganizer ...$organizers): void + public function create(UdbOrganizer ...$organizers): void { DB::transaction(function () use ($organizers): void { foreach ($organizers as $organizer) { @@ -23,7 +23,7 @@ public function create(UiTdatabankOrganizer ...$organizers): void }); } - public function delete(UiTdatabankOrganizer $organizer): void + public function delete(UdbOrganizer $organizer): void { UiTdatabankOrganizerModel::query() ->where('organizer_id', $organizer->organizerId) diff --git a/app/Domain/Integrations/Repositories/UiTdatabankOrganizerRepository.php b/app/Domain/Integrations/Repositories/UiTdatabankOrganizerRepository.php index f26a977c1..6b45f466c 100644 --- a/app/Domain/Integrations/Repositories/UiTdatabankOrganizerRepository.php +++ b/app/Domain/Integrations/Repositories/UiTdatabankOrganizerRepository.php @@ -4,11 +4,11 @@ namespace App\Domain\Integrations\Repositories; -use App\Domain\Integrations\UiTdatabankOrganizer; +use App\Domain\Integrations\UdbOrganizer; interface UiTdatabankOrganizerRepository { - public function create(UiTdatabankOrganizer ...$organizer): void; + public function create(UdbOrganizer ...$organizer): void; - public function delete(UiTdatabankOrganizer $organizer): void; + public function delete(UdbOrganizer $organizer): void; } diff --git a/app/Domain/Integrations/UiTdatabankOrganizer.php b/app/Domain/Integrations/UdbOrganizer.php similarity index 86% rename from app/Domain/Integrations/UiTdatabankOrganizer.php rename to app/Domain/Integrations/UdbOrganizer.php index ca2fed1e4..fed67ab02 100644 --- a/app/Domain/Integrations/UiTdatabankOrganizer.php +++ b/app/Domain/Integrations/UdbOrganizer.php @@ -6,7 +6,7 @@ use Ramsey\Uuid\UuidInterface; -final readonly class UiTdatabankOrganizer +final readonly class UdbOrganizer { public function __construct( public UuidInterface $id, diff --git a/app/Nova/Actions/ActivateUitpasIntegration.php b/app/Nova/Actions/ActivateUitpasIntegration.php index 670e40f87..08a2a5bf3 100644 --- a/app/Nova/Actions/ActivateUitpasIntegration.php +++ b/app/Nova/Actions/ActivateUitpasIntegration.php @@ -5,7 +5,7 @@ namespace App\Nova\Actions; use App\Domain\Integrations\Models\IntegrationModel; -use App\Domain\Integrations\UiTdatabankOrganizer; +use App\Domain\Integrations\UdbOrganizer; use App\Domain\Integrations\Repositories\IntegrationRepository; use App\Domain\Integrations\Repositories\UiTdatabankOrganizerRepository; use App\Domain\Organizations\Models\OrganizationModel; @@ -46,7 +46,7 @@ public function handle(ActionFields $fields, Collection $integrations): ActionRe foreach ($organizerArray as $organizer) { $this->organizerRepository->create( - new UiTdatabankOrganizer( + new UdbOrganizer( Uuid::uuid4(), Uuid::fromString($integration->id), $organizer diff --git a/app/Nova/Actions/AddUiTdatabankOrganizer.php b/app/Nova/Actions/AddUiTdatabankOrganizer.php index c6ee577a8..261b29b9c 100644 --- a/app/Nova/Actions/AddUiTdatabankOrganizer.php +++ b/app/Nova/Actions/AddUiTdatabankOrganizer.php @@ -5,7 +5,7 @@ namespace App\Nova\Actions; use App\Domain\Integrations\Models\IntegrationModel; -use App\Domain\Integrations\UiTdatabankOrganizer; +use App\Domain\Integrations\UdbOrganizer; use App\Domain\Integrations\Repositories\UiTdatabankOrganizerRepository; use Illuminate\Bus\Queueable; use Illuminate\Queue\InteractsWithQueue; @@ -37,7 +37,7 @@ public function handle(ActionFields $fields, Collection $integrations): ActionRe $organizationIdAsString = $fields->get('organizer_id'); $this->organizerRepository->create( - new UiTdatabankOrganizer( + new UdbOrganizer( Uuid::uuid4(), Uuid::fromString($integration->id), $organizationIdAsString