Handling ICAL import
This commit is contained in:
31
app/Domains/Event/Controllers/ParticipantIcalController.php
Normal file
31
app/Domains/Event/Controllers/ParticipantIcalController.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Event\Controllers;
|
||||
|
||||
use App\Domains\Event\Actions\GenerateIcal\GenerateIcalCommand;
|
||||
use App\Domains\Event\Actions\GenerateIcal\GenerateIcalRequest;
|
||||
use App\Models\EventParticipant;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ParticipantIcalController extends CommonController
|
||||
{
|
||||
public function __invoke(string $participantIdentifier, Request $request): Response
|
||||
{
|
||||
$participant = $this->eventParticipants->getMyParticipationByIdentifier($participantIdentifier);
|
||||
|
||||
if ($participant === null) {
|
||||
abort(403, 'Zugriff verweigert.');
|
||||
}
|
||||
|
||||
$icalRequest = new GenerateIcalRequest($participant);
|
||||
$icalCommand = new GenerateIcalCommand($icalRequest);
|
||||
$icalResponse = $icalCommand->execute();
|
||||
|
||||
return response($icalResponse->icalContent, 200, [
|
||||
'Content-Type' => 'text/calendar; charset=utf-8',
|
||||
'Content-Disposition' => 'attachment; filename="' . $icalResponse->filename . '"',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Event\Controllers;
|
||||
|
||||
use App\Domains\Event\Actions\GenerateIcal\GenerateIcalCommand;
|
||||
use App\Domains\Event\Actions\GenerateIcal\GenerateIcalRequest;
|
||||
use App\Domains\Event\Actions\GenerateIcalForDeadline\GenerateIcalForDeadlineCommand;
|
||||
use App\Domains\Event\Actions\GenerateIcalForDeadline\GenerateIcalForDeadlineRequest;
|
||||
use App\Models\EventParticipant;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ParticipantIcalForPaymentController extends CommonController
|
||||
{
|
||||
public function __invoke(string $participantIdentifier, Request $request): Response
|
||||
{
|
||||
$participant = $this->eventParticipants->getMyParticipationByIdentifier($participantIdentifier);
|
||||
|
||||
if ($participant === null) {
|
||||
abort(403, 'Zugriff verweigert.');
|
||||
}
|
||||
|
||||
$icalRequest = new GenerateIcalForDeadlineRequest($participant->event()->first());
|
||||
$icalCommand = new GenerateIcalForDeadlineCommand($icalRequest);
|
||||
$icalResponse = $icalCommand->execute();
|
||||
|
||||
return response($icalResponse->icalContent, 200, [
|
||||
'Content-Type' => 'text/calendar; charset=utf-8',
|
||||
'Content-Disposition' => 'attachment; filename="' . $icalResponse->filename . '"',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -159,12 +159,6 @@ class SignupController extends CommonController {
|
||||
'status' => 'success',
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dd($eventId, $registrationData, $amount);
|
||||
}
|
||||
|
||||
public function calculateAmount(int $eventId, Request $request, bool $forDisplay = true) : JsonResponse | float {
|
||||
|
||||
Reference in New Issue
Block a user