feat(ticket): add tickets endpoint and resource for sales; implement ticket retrieval logic and tests

This commit is contained in:
2026-08-11 11:20:55 -03:00
parent a458c564ca
commit 2115d2384d
7 changed files with 136 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ use App\Domains\Logging\Models\ValueChange;
use App\Domains\Purchase\Models\Purchase;
use App\Domains\Purchase\Services\CheckoutService;
use App\Domains\Tenant\Models\Tenant;
use App\Domains\Ticket\Models\Ticket;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
@@ -52,6 +53,16 @@ class AdminAppSaleService
->findOrFail($saleId);
}
/** @return Collection<int, Ticket> */
public function tickets(Tenant $tenant, int $saleId): Collection
{
return $this->findForTenant($tenant, $saleId)
->tickets()
->with('validityTime')
->orderBy('id')
->get();
}
public function confirm(Tenant $tenant, int $saleId): Purchase
{
$sale = $this->findForTenant($tenant, $saleId);