updated table structure for photobooth/sparkbooth settings. now there's a separate table for it. update all references and tests. also fixed the notification panel and the lightbox in the guest app.

This commit is contained in:
Codex Agent
2025-12-18 08:49:56 +01:00
parent ece38fc009
commit 1c4acda332
30 changed files with 734 additions and 538 deletions

View File

@@ -3,6 +3,7 @@
namespace Tests\Feature\Console;
use App\Models\Event;
use App\Models\EventPhotoboothSetting;
use App\Models\PhotoboothSetting;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Http;
@@ -23,15 +24,18 @@ class PhotoboothCleanupCommandTest extends TestCase
'control_service_base_url' => 'https://control.test',
]);
$event = Event::factory()->create([
'photobooth_enabled' => true,
'photobooth_username' => 'pbcleanup',
'photobooth_status' => 'active',
'photobooth_path' => '/photobooth/demo',
'photobooth_expires_at' => now()->subDay(),
]);
$event->photobooth_password = 'CLEANUP';
$event->save();
$event = Event::factory()->create();
$setting = EventPhotoboothSetting::factory()
->for($event)
->create([
'enabled' => true,
'mode' => 'ftp',
'username' => 'pbcleanup',
'password' => 'CLEANUP',
'status' => 'active',
'path' => '/photobooth/demo',
'expires_at' => now()->subDay(),
]);
Http::fake([
'https://control.test/*' => Http::response(['ok' => true], 200),
@@ -40,11 +44,11 @@ class PhotoboothCleanupCommandTest extends TestCase
$this->artisan('photobooth:cleanup-expired')
->assertExitCode(0);
$event->refresh();
$setting->refresh();
$this->assertFalse($event->photobooth_enabled);
$this->assertNull($event->photobooth_username);
$this->assertNotNull($event->photobooth_last_deprovisioned_at);
$this->assertFalse($setting->enabled);
$this->assertNull($setting->username);
$this->assertNotNull($setting->last_deprovisioned_at);
Http::assertSent(fn ($request) => $request->url() === 'https://control.test/users/pbcleanup');
}

View File

@@ -3,6 +3,7 @@
namespace Tests\Feature\Photobooth;
use App\Models\Event;
use App\Models\EventPhotoboothSetting;
use App\Models\PhotoboothSetting;
use Illuminate\Support\Facades\Http;
use PHPUnit\Framework\Attributes\Test;
@@ -58,11 +59,13 @@ class PhotoboothControllerTest extends TenantTestCase
->assertJsonPath('data.username', fn ($value) => is_string($value) && strlen($value) <= 10);
$event->refresh();
$this->assertTrue($event->photobooth_enabled);
$this->assertNotNull($event->photobooth_username);
$this->assertNotNull($event->photobooth_password);
$username = $event->photobooth_username;
$firstPassword = $event->photobooth_password;
$setting = $event->photoboothSetting;
$this->assertNotNull($setting);
$this->assertTrue($setting->enabled);
$this->assertNotNull($setting->username);
$this->assertNotNull($setting->password);
$username = $setting->username;
$firstPassword = $setting->password;
Http::assertSent(fn ($request) => $request->url() === 'https://control.test/users' && $request['username'] === $username);
@@ -72,7 +75,7 @@ class PhotoboothControllerTest extends TenantTestCase
->assertJsonPath('data.enabled', true);
$event->refresh();
$this->assertNotSame($firstPassword, $event->photobooth_password);
$this->assertNotSame($firstPassword, $event->photoboothSetting?->password);
Http::assertSent(fn ($request) => $request->url() === "https://control.test/users/{$username}/rotate");
}
@@ -82,14 +85,18 @@ class PhotoboothControllerTest extends TenantTestCase
{
$event = Event::factory()->for($this->tenant)->create([
'slug' => 'photobooth-disable',
'photobooth_enabled' => true,
'photobooth_username' => 'pb123456',
'photobooth_path' => '/photobooth/demo',
'photobooth_status' => 'active',
'photobooth_expires_at' => now()->subDay(),
]);
$event->photobooth_password = 'SECRET12';
$event->save();
EventPhotoboothSetting::factory()
->for($event)
->create([
'enabled' => true,
'mode' => 'ftp',
'username' => 'pb123456',
'password' => 'SECRET12',
'path' => '/photobooth/demo',
'status' => 'active',
'expires_at' => now()->subDay(),
]);
Http::fake([
'https://control.test/*' => Http::response(['ok' => true], 200),
@@ -102,8 +109,8 @@ class PhotoboothControllerTest extends TenantTestCase
->assertJsonPath('data.username', null);
$event->refresh();
$this->assertFalse($event->photobooth_enabled);
$this->assertNull($event->photobooth_username);
$this->assertFalse($event->photoboothSetting?->enabled);
$this->assertNull($event->photoboothSetting?->username);
Http::assertSent(fn ($request) => $request->url() === 'https://control.test/users/pb123456');
}

View File

@@ -3,6 +3,7 @@
namespace Tests\Feature\Photobooth;
use App\Models\Event;
use App\Models\EventPhotoboothSetting;
use App\Models\Photo;
use App\Models\Tenant;
use App\Services\EventJoinTokenService;
@@ -22,18 +23,25 @@ class PhotoboothFilterTest extends TestCase
->for($tenant)
->create([
'status' => 'published',
'photobooth_enabled' => true,
]);
EventPhotoboothSetting::factory()
->for($event)
->create([
'enabled' => true,
'mode' => 'ftp',
]);
Photo::factory()->create([
'event_id' => $event->id,
'ingest_source' => Photo::SOURCE_PHOTOBOOTH,
'guest_name' => Photo::SOURCE_PHOTOBOOTH,
'status' => 'approved',
]);
Photo::factory()->create([
'event_id' => $event->id,
'ingest_source' => Photo::SOURCE_GUEST_PWA,
'status' => 'approved',
]);
/** @var EventJoinTokenService $tokens */

View File

@@ -6,6 +6,7 @@ use App\Jobs\ProcessPhotoSecurityScan;
use App\Models\Emotion;
use App\Models\Event;
use App\Models\EventPackage;
use App\Models\EventPhotoboothSetting;
use App\Models\MediaStorageTarget;
use App\Models\Package;
use App\Models\Photo;
@@ -53,12 +54,15 @@ class PhotoboothIngestCommandTest extends TestCase
->create([
'slug' => 'demo-event',
'status' => 'published',
'photobooth_enabled' => true,
]);
$event->update([
'photobooth_path' => $tenant->slug.'/'.$event->id,
]);
$setting = EventPhotoboothSetting::factory()
->for($event)
->create([
'enabled' => true,
'mode' => 'ftp',
'path' => $tenant->slug.'/'.$event->id,
]);
$package = Package::factory()->create(['max_photos' => 5]);
EventPackage::create([
@@ -68,7 +72,8 @@ class PhotoboothIngestCommandTest extends TestCase
'used_photos' => 0,
]);
Storage::disk('photobooth')->put($event->photobooth_path.'/sample.jpg', $this->sampleImage());
Storage::disk('photobooth')->makeDirectory($setting->path);
Storage::disk('photobooth')->put($setting->path.'/sample.jpg', $this->sampleImage());
Emotion::factory()->create();
Bus::fake();
@@ -81,7 +86,7 @@ class PhotoboothIngestCommandTest extends TestCase
'ingest_source' => Photo::SOURCE_PHOTOBOOTH,
]);
Storage::disk('photobooth')->assertMissing($event->photobooth_path.'/sample.jpg');
Storage::disk('photobooth')->assertMissing($setting->path.'/sample.jpg');
Bus::assertDispatched(ProcessPhotoSecurityScan::class);
}