-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into PPF-485-unblock-insightly
- Loading branch information
Showing
20 changed files
with
867 additions
and
482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,7 +141,7 @@ E2E_TEST_PASSWORD= | |
E2E_TEST_ADMIN_EMAIL=[email protected] | ||
E2E_TEST_ADMIN_PASSWORD= | ||
|
||
UITPAS_INTEGRATION_TYPE_ENABLED=true | ||
UITPAS_INTEGRATION_TYPE_ENABLED=false | ||
VITE_UITPAS_INTEGRATION_TYPE_ENABLED=${UITPAS_INTEGRATION_TYPE_ENABLED} | ||
|
||
SEARCH_BASE_URI=https://search-acc.uitdatabank.be/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Domain\Integrations\Models; | ||
|
||
use App\Domain\Integrations\Organizer; | ||
use App\Models\UuidModel; | ||
use Ramsey\Uuid\Uuid; | ||
|
||
final class OrganizerModel extends UuidModel | ||
{ | ||
protected $table = 'organizers'; | ||
|
||
protected $fillable = [ | ||
'id', | ||
'integration_id', | ||
'organizer_id', | ||
]; | ||
|
||
public function toDomain(): Organizer | ||
{ | ||
return new Organizer( | ||
Uuid::fromString($this->id), | ||
Uuid::fromString($this->integration_id), | ||
Uuid::fromString($this->organizer_id), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Domain\Integrations; | ||
|
||
use Ramsey\Uuid\UuidInterface; | ||
|
||
final readonly class Organizer | ||
{ | ||
public function __construct( | ||
public UuidInterface $id, | ||
public UuidInterface $integrationId, | ||
public UuidInterface $organizerId | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Domain\Integrations\Policies; | ||
|
||
use App\Domain\Auth\Models\UserModel; | ||
use App\Domain\Integrations\Models\OrganizerModel; | ||
|
||
final class OrganizerPolicy | ||
{ | ||
public function viewAny(UserModel $userModel): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function view(UserModel $userModel, OrganizerModel $organizerModel): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function create(UserModel $userModel): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function update(UserModel $userModel, OrganizerModel $organizerModel): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function delete(UserModel $userModel, OrganizerModel $organizerModel): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function restore(UserModel $userModel, OrganizerModel $organizerModel): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function replicate(UserModel $userModel, OrganizerModel $organizerModel): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function forceDelete(UserModel $userModel, OrganizerModel $organizerModel): bool | ||
{ | ||
return false; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
app/Domain/Integrations/Repositories/EloquentOrganizerRepository.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Domain\Integrations\Repositories; | ||
|
||
use App\Domain\Integrations\Models\OrganizerModel; | ||
use App\Domain\Integrations\Organizer; | ||
|
||
final class EloquentOrganizerRepository implements OrganizerRepository | ||
{ | ||
public function create(Organizer $organizer): void | ||
{ | ||
OrganizerModel::query()->create([ | ||
'id' => $organizer->id->toString(), | ||
'integration_id' => $organizer->integrationId->toString(), | ||
'organizer_id' => $organizer->organizerId->toString(), | ||
]); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/Domain/Integrations/Repositories/OrganizerRepository.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Domain\Integrations\Repositories; | ||
|
||
use App\Domain\Integrations\Organizer; | ||
|
||
interface OrganizerRepository | ||
{ | ||
public function create(Organizer $organizer): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Nova\Actions; | ||
|
||
use App\Domain\Integrations\Models\IntegrationModel; | ||
use App\Domain\Integrations\Organizer; | ||
use App\Domain\Integrations\Repositories\OrganizerRepository; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Queue\InteractsWithQueue; | ||
use Illuminate\Support\Collection; | ||
use Illuminate\Support\Facades\Log; | ||
use Laravel\Nova\Actions\Action; | ||
use Laravel\Nova\Actions\ActionResponse; | ||
use Laravel\Nova\Fields\ActionFields; | ||
use Laravel\Nova\Fields\Text; | ||
use Laravel\Nova\Http\Requests\NovaRequest; | ||
use Ramsey\Uuid\Uuid; | ||
|
||
final class AddOrganizer extends Action | ||
{ | ||
use InteractsWithQueue; | ||
use Queueable; | ||
|
||
public function __construct(private readonly OrganizerRepository $organizerRepository) | ||
{ | ||
} | ||
|
||
public function handle(ActionFields $fields, Collection $integrations): ActionResponse | ||
{ | ||
Log::info('AddOrganizer action started.'); | ||
/** @var IntegrationModel $integration */ | ||
$integration = $integrations->first(); | ||
|
||
/** @var string $organizationIdAsString */ | ||
$organizationIdAsString = $fields->get('organizer_id'); | ||
$organizationId = Uuid::fromString($organizationIdAsString); | ||
|
||
$this->organizerRepository->create( | ||
new Organizer( | ||
Uuid::uuid4(), | ||
Uuid::fromString($integration->id), | ||
$organizationId | ||
) | ||
); | ||
|
||
return Action::message('Organizer "' . $organizationIdAsString . '" added.'); | ||
} | ||
|
||
public function fields(NovaRequest $request): array | ||
{ | ||
return [ | ||
Text::make('Organizer ID', 'organizer_id') | ||
->rules( | ||
'required', | ||
'string' | ||
), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Nova\Resources; | ||
|
||
use App\Domain\Integrations\Models\OrganizerModel; | ||
use App\Nova\Resource; | ||
use Laravel\Nova\Fields\Field; | ||
use Laravel\Nova\Fields\HasMany; | ||
use Laravel\Nova\Fields\ID; | ||
use Laravel\Nova\Fields\Text; | ||
use Laravel\Nova\Http\Requests\NovaRequest; | ||
|
||
/** | ||
* @mixin OrganizerModel | ||
*/ | ||
final class Organizer extends Resource | ||
{ | ||
public static string $model = OrganizerModel::class; | ||
|
||
public static $title = 'organizer_id'; | ||
|
||
public static $displayInNavigation = false; | ||
|
||
/** | ||
* @var array<string> | ||
*/ | ||
public static $search = [ | ||
'id', | ||
'integration_id', | ||
'organizer_id', | ||
]; | ||
|
||
/** | ||
* @return array<Field> | ||
*/ | ||
public function fields(NovaRequest $request): array | ||
{ | ||
return [ | ||
ID::make() | ||
->readonly() | ||
->hideFromIndex(), | ||
|
||
Text::make('organizer_id') | ||
->readonly(), | ||
|
||
HasMany::make('Activity Log'), | ||
]; | ||
} | ||
} |
Oops, something went wrong.