feat: enhance address handling with coordinates and integrate into event resources

This commit is contained in:
2026-09-30 10:59:41 -03:00
parent 5d5ee7d2a5
commit 6588d9f1a8
13 changed files with 282 additions and 8 deletions

View File

@@ -2,18 +2,18 @@
namespace App\Domains\Ticketing\Event\Services;
use App\Domains\Core\Auth\Models\User;
use App\Domains\Commerce\Cart\Services\InvalidateEventDateCartsService;
use App\Domains\Commerce\Catalog\Models\Variant;
use App\Domains\Commerce\Catalog\Services\StockReservationService;
use App\Domains\Commerce\Catalog\Services\VariantReplacementService;
use App\Domains\Core\Auth\Models\User;
use App\Domains\Core\Tenant\Models\Tenant;
use App\Domains\Ticketing\Event\Enums\EventDateChangeType;
use App\Domains\Ticketing\Event\Events\EventDateRescheduled;
use App\Domains\Ticketing\Event\Events\EventDateSuspended;
use App\Domains\Ticketing\Event\Models\Event;
use App\Domains\Ticketing\Event\Models\EventDate;
use App\Domains\Ticketing\Event\Models\EventDateChange;
use App\Domains\Ticketing\Event\Models\Event;
use App\Domains\Core\Tenant\Models\Tenant;
use App\Domains\Ticketing\Ticket\Models\Ticket;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
@@ -32,11 +32,12 @@ class EventService
private readonly AffectedEventDatePurchaseResolver $affectedPurchaseResolver,
private readonly VariantReplacementService $variantReplacementService,
private readonly InvalidateEventDateCartsService $invalidateEventDateCarts,
private readonly EventAddressService $eventAddressService,
) {}
public function forTenant(Tenant $tenant): Event
{
return $tenant->activeEvent->load(['dates.validityTime', 'socialMedia']);
return $tenant->activeEvent->load(['dates.validityTime', 'socialMedia', 'address']);
}
/** @param array<string, mixed> $data */
@@ -49,6 +50,7 @@ class EventService
'location' => $data['location'],
...array_intersect_key($data, ['attachment_id' => true, 'exact_location' => true]),
]);
$this->eventAddressService->syncLocation($event, array_key_exists('exact_location', $data));
$tenant->update([
...array_intersect_key($data, array_flip([
'allow_ticket_refund',
@@ -64,7 +66,7 @@ class EventService
$this->syncLegacyContact($event, $data['contact']);
}
return $event->load(['dates.validityTime', 'socialMedia']);
return $event->load(['dates.validityTime', 'socialMedia', 'address']);
});
}