Skip to content

Commit

Permalink
Revert "rename Organizer to UiTdatabankOrganizer"
Browse files Browse the repository at this point in the history
This reverts commit 63eb86f.
  • Loading branch information
JonasVHG committed Aug 2, 2024
1 parent 77254db commit a2fd5fd
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions app/Domain/Integrations/Controllers/IntegrationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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\Organizer;
use App\Domain\Integrations\Repositories\IntegrationRepository;
use App\Domain\Integrations\Repositories\IntegrationUrlRepository;
use App\Domain\Integrations\Repositories\OrganizerRepository;
Expand Down Expand Up @@ -297,10 +297,10 @@ public function updateOrganizers(string $integrationId, UpdateIntegrationOrganiz
{
$integration = $this->integrationRepository->getById(Uuid::fromString($integrationId));

$organizerIds = collect($integration->organizers())->map(fn (UiTdatabankOrganizer $organizer) => $organizer->organizerId);
$organizerIds = collect($integration->organizers())->map(fn (Organizer $organizer) => $organizer->organizerId);
$newOrganizers = array_filter(
OrganizerMapper::mapUpdateOrganizers($request, $integrationId),
fn (UiTdatabankOrganizer $organizer) => !in_array($organizer->organizerId, $organizerIds->toArray(), true)
fn (Organizer $organizer) => !in_array($organizer->organizerId, $organizerIds->toArray(), true)
);

$this->organizerRepository->create(...$newOrganizers);
Expand All @@ -310,7 +310,7 @@ public function updateOrganizers(string $integrationId, UpdateIntegrationOrganiz

public function deleteOrganizer(string $integrationId, string $organizerId): RedirectResponse
{
$this->organizerRepository->delete(new UiTdatabankOrganizer(
$this->organizerRepository->delete(new Organizer(
Uuid::uuid4(),
Uuid::fromString($integrationId),
$organizerId
Expand Down Expand Up @@ -404,7 +404,7 @@ private function guardUserIsContact(Request $request, string $integrationId): ?R

public function getIntegrationOrganizersWithTestOrganizer(Integration $integration): Collection
{
$organizerIds = collect($integration->organizers())->map(fn (UiTdatabankOrganizer $organizer) => $organizer->organizerId);
$organizerIds = collect($integration->organizers())->map(fn (Organizer $organizer) => $organizer->organizerId);
$uitpasOrganizers = $this->searchClient->findUiTPASOrganizers(...$organizerIds)->getMember()?->getItems();

$organizers = collect($uitpasOrganizers)->map(function (SapiOrganizer $organizer) {
Expand Down
6 changes: 3 additions & 3 deletions app/Domain/Integrations/Integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class Integration

private ?Organization $organization;

/** @var array<UiTdatabankOrganizer> */
/** @var array<Organizer> */
private array $organizers;

/** @var array<UiTiDv1Consumer> */
Expand Down Expand Up @@ -126,7 +126,7 @@ public function withKeycloakClients(KeycloakClient ...$keycloakClients): self
return $clone;
}

public function withOrganizers(UiTdatabankOrganizer ...$organizers): self
public function withOrganizers(Organizer ...$organizers): self
{
$clone = clone $this;
$clone->organizers = $organizers;
Expand Down Expand Up @@ -178,7 +178,7 @@ public function organization(): ?Organization
}

/**
* @return array<UiTdatabankOrganizer>
* @return array<Organizer>
*/
public function organizers(): array
{
Expand Down
8 changes: 4 additions & 4 deletions app/Domain/Integrations/Mappers/OrganizerMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@

use App\Domain\Integrations\FormRequests\RequestActivationRequest;
use App\Domain\Integrations\FormRequests\UpdateIntegrationOrganizersRequest;
use App\Domain\Integrations\UiTdatabankOrganizer;
use App\Domain\Integrations\Organizer;
use Illuminate\Http\Request;
use Ramsey\Uuid\Uuid;

final class OrganizerMapper
{
/**
* @return UiTdatabankOrganizer[]
* @return Organizer[]
*/
public static function map(Request $request, string $id): array
{
/**
* @var UiTdatabankOrganizer[] $organizers
* @var Organizer[] $organizers
*/
$organizers = [];

foreach ($request->input('organizers') ?? [] as $organizer) {
$organizers[] = new UiTdatabankOrganizer(
$organizers[] = new Organizer(
Uuid::uuid4(),
Uuid::fromString($id),
$organizer['id']
Expand Down
6 changes: 3 additions & 3 deletions app/Domain/Integrations/Models/OrganizerModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace App\Domain\Integrations\Models;

use App\Domain\Integrations\UiTdatabankOrganizer;
use App\Domain\Integrations\Organizer;
use App\Models\UuidModel;
use Ramsey\Uuid\Uuid;

Expand All @@ -18,9 +18,9 @@ final class OrganizerModel extends UuidModel
'organizer_id',
];

public function toDomain(): UiTdatabankOrganizer
public function toDomain(): Organizer
{
return new UiTdatabankOrganizer(
return new Organizer(
Uuid::fromString($this->id),
Uuid::fromString($this->integration_id),
$this->organizer_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Ramsey\Uuid\UuidInterface;

final readonly class UiTdatabankOrganizer
final readonly class Organizer
{
public function __construct(
public UuidInterface $id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
namespace App\Domain\Integrations\Repositories;

use App\Domain\Integrations\Models\OrganizerModel;
use App\Domain\Integrations\UiTdatabankOrganizer;
use App\Domain\Integrations\Organizer;
use Illuminate\Support\Facades\DB;

final class EloquentOrganizerRepository implements OrganizerRepository
{
public function create(UiTdatabankOrganizer ...$organizers): void
public function create(Organizer ...$organizers): void
{
DB::transaction(function () use ($organizers): void {
foreach ($organizers as $organizer) {
Expand All @@ -23,7 +23,7 @@ public function create(UiTdatabankOrganizer ...$organizers): void
});
}

public function delete(UiTdatabankOrganizer $organizer): void
public function delete(Organizer $organizer): void
{
OrganizerModel::query()
->where('organizer_id', $organizer->organizerId)
Expand Down
6 changes: 3 additions & 3 deletions app/Domain/Integrations/Repositories/OrganizerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace App\Domain\Integrations\Repositories;

use App\Domain\Integrations\UiTdatabankOrganizer;
use App\Domain\Integrations\Organizer;

interface OrganizerRepository
{
public function create(UiTdatabankOrganizer ...$organizer): void;
public function create(Organizer ...$organizer): void;

public function delete(UiTdatabankOrganizer $organizer): void;
public function delete(Organizer $organizer): void;
}
4 changes: 2 additions & 2 deletions app/Nova/Actions/ActivateUitpasIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace App\Nova\Actions;

use App\Domain\Integrations\Models\IntegrationModel;
use App\Domain\Integrations\UiTdatabankOrganizer;
use App\Domain\Integrations\Organizer;
use App\Domain\Integrations\Repositories\IntegrationRepository;
use App\Domain\Integrations\Repositories\OrganizerRepository;
use App\Domain\Organizations\Models\OrganizationModel;
Expand Down Expand Up @@ -46,7 +46,7 @@ public function handle(ActionFields $fields, Collection $integrations): ActionRe

foreach ($organizerArray as $organizer) {
$this->organizerRepository->create(
new UiTdatabankOrganizer(
new Organizer(
Uuid::uuid4(),
Uuid::fromString($integration->id),
$organizer
Expand Down
4 changes: 2 additions & 2 deletions app/Nova/Actions/AddOrganizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace App\Nova\Actions;

use App\Domain\Integrations\Models\IntegrationModel;
use App\Domain\Integrations\UiTdatabankOrganizer;
use App\Domain\Integrations\Organizer;
use App\Domain\Integrations\Repositories\OrganizerRepository;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\InteractsWithQueue;
Expand Down Expand Up @@ -37,7 +37,7 @@ public function handle(ActionFields $fields, Collection $integrations): ActionRe
$organizationIdAsString = $fields->get('organizer_id');

$this->organizerRepository->create(
new UiTdatabankOrganizer(
new Organizer(
Uuid::uuid4(),
Uuid::fromString($integration->id),
$organizationIdAsString
Expand Down

0 comments on commit a2fd5fd

Please sign in to comment.