feat(ticket): add client and category fields to ticket resource and update related tests
This commit is contained in:
parent
622a3eef86
commit
cb98652e2f
|
|
@ -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()),
|
||||
|
|
|
|||
|
|
@ -135,9 +135,10 @@ class ScannerTicketService
|
|||
{
|
||||
return [
|
||||
'validityGroups.validityTimes',
|
||||
'sourceCatalogItem',
|
||||
'sourceCatalogItem.category',
|
||||
'sourceVariant.eventDate',
|
||||
'sourceVariant.catalogItem',
|
||||
'user',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue