Add service API for Meet to list and link virtual events.
Deploy Ladill Events / deploy (push) Successful in 1m17s
Deploy Ladill Events / deploy (push) Successful in 1m17s
Meet can attach existing conference or webinar rooms to event virtual sessions so registration stays in Events. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\QrCode;
|
||||
use App\Models\User;
|
||||
use App\Services\Meet\EventMeetRoomLinkService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ServiceMeetController extends Controller
|
||||
{
|
||||
public function __construct(private readonly EventMeetRoomLinkService $links) {}
|
||||
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'owner_ref' => ['required', 'string', 'max:64'],
|
||||
]);
|
||||
|
||||
$owner = User::query()->where('public_id', $validated['owner_ref'])->firstOrFail();
|
||||
|
||||
return response()->json([
|
||||
'events' => $this->links->linkableEvents($owner),
|
||||
]);
|
||||
}
|
||||
|
||||
public function linkRoom(Request $request, QrCode $event): JsonResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'owner_ref' => ['required', 'string', 'max:64'],
|
||||
'meet_room_uuid' => ['required', 'string', 'max:64'],
|
||||
'meet_room_type' => ['required', 'string', 'in:town_hall,webinar'],
|
||||
'join_url' => ['nullable', 'string', 'max:2048'],
|
||||
'title' => ['nullable', 'string', 'max:255'],
|
||||
'scheduled_at' => ['nullable', 'date'],
|
||||
'duration_minutes' => ['nullable', 'integer', 'min:15', 'max:480'],
|
||||
'virtual_session_id' => ['nullable', 'string', 'max:64'],
|
||||
]);
|
||||
|
||||
$owner = User::query()->where('public_id', $validated['owner_ref'])->firstOrFail();
|
||||
abort_unless($event->type === QrCode::TYPE_EVENT, 404);
|
||||
|
||||
$result = $this->links->linkRoom($owner, $event, $validated);
|
||||
|
||||
return response()->json(['event' => $result]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user