feat(ticket): add client and category fields to ticket resource and update related tests

This commit is contained in:
2026-08-11 16:59:50 -03:00
parent 622a3eef86
commit cb98652e2f
3 changed files with 6 additions and 1 deletions

View File

@@ -18,6 +18,8 @@ class TicketResource extends JsonResource
'ticket' => $this->ticket,
'name' => $this->name,
'description' => $this->description,
'client' => $this->user?->nombre_apellido,
'category' => $this->sourceCatalogItem?->category?->nombre,
'source_catalog_item_id' => $this->source_catalog_item_id,
'source_variant_id' => $this->source_variant_id,
'validity_times' => ValidityTimeResource::collection($this->allValidityTimes()),

View File

@@ -135,9 +135,10 @@ class ScannerTicketService
{
return [
'validityGroups.validityTimes',
'sourceCatalogItem',
'sourceCatalogItem.category',
'sourceVariant.eventDate',
'sourceVariant.catalogItem',
'user',
];
}

View File

@@ -161,6 +161,8 @@ class ScannerTicketControllerTest extends TestCase
->assertJsonPath('data.id', $ticket->id)
->assertJsonPath('data.ticket', $ticket->ticket)
->assertJsonPath('data.name', $ticket->name)
->assertJsonPath('data.client', $this->ticketOwner->nombre_apellido)
->assertJsonPath('data.category', $this->category->nombre)
->assertJsonPath('data.is_valid', true)
->assertJsonPath('data.is_used', false);
}