From ef7c482b4add41bde2a759f4d0df9a2ca816d97f Mon Sep 17 00:00:00 2001 From: "bert.hausmans" Date: Thu, 16 Apr 2026 20:42:25 +0200 Subject: [PATCH] fix: allow registration_banner_url and registration_logo_url on event update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missing from UpdateEventRequest rules, so the fields were stripped from validated() and the uploaded URLs never persisted — the preview showed briefly in the upload component but disappeared on reload because the event record still had null. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Requests/Api/V1/UpdateEventRequest.php | 2 ++ api/tests/Feature/Event/EventTest.php | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/api/app/Http/Requests/Api/V1/UpdateEventRequest.php b/api/app/Http/Requests/Api/V1/UpdateEventRequest.php index 9bd6f792..d59c21a2 100644 --- a/api/app/Http/Requests/Api/V1/UpdateEventRequest.php +++ b/api/app/Http/Requests/Api/V1/UpdateEventRequest.php @@ -29,6 +29,8 @@ final class UpdateEventRequest extends FormRequest 'event_type_label' => ['nullable', 'string', 'max:50'], 'sub_event_label' => ['nullable', 'string', 'max:50'], 'registration_welcome_text' => ['nullable', 'string', 'max:1000'], + 'registration_banner_url' => ['nullable', 'string', 'max:2048'], + 'registration_logo_url' => ['nullable', 'string', 'max:2048'], 'registration_show_section_preferences' => ['nullable', 'boolean'], 'registration_show_availability' => ['nullable', 'boolean'], ]; diff --git a/api/tests/Feature/Event/EventTest.php b/api/tests/Feature/Event/EventTest.php index 45635bd3..89371e96 100644 --- a/api/tests/Feature/Event/EventTest.php +++ b/api/tests/Feature/Event/EventTest.php @@ -223,6 +223,38 @@ class EventTest extends TestCase ]); } + public function test_org_admin_can_update_registration_banner_and_logo_urls(): void + { + $event = Event::factory()->create([ + 'organisation_id' => $this->organisation->id, + 'registration_banner_url' => null, + 'registration_logo_url' => null, + ]); + + Sanctum::actingAs($this->orgAdmin); + + $bannerUrl = 'http://localhost:8000/storage/uploads/banner/abc/banner.png'; + $logoUrl = 'http://localhost:8000/storage/uploads/logo/abc/logo.png'; + + $this->putJson("/api/v1/organisations/{$this->organisation->id}/events/{$event->id}", [ + 'registration_banner_url' => $bannerUrl, + ])->assertOk()->assertJsonPath('data.registration_banner_url', $bannerUrl); + + $this->putJson("/api/v1/organisations/{$this->organisation->id}/events/{$event->id}", [ + 'registration_logo_url' => $logoUrl, + ])->assertOk()->assertJsonPath('data.registration_logo_url', $logoUrl); + + $this->assertDatabaseHas('events', [ + 'id' => $event->id, + 'registration_banner_url' => $bannerUrl, + 'registration_logo_url' => $logoUrl, + ]); + + $this->putJson("/api/v1/organisations/{$this->organisation->id}/events/{$event->id}", [ + 'registration_banner_url' => null, + ])->assertOk()->assertJsonPath('data.registration_banner_url', null); + } + public function test_event_manager_can_update_event(): void { $event = Event::factory()->create(['organisation_id' => $this->organisation->id]);