feat(ticket): implement validity time management for tickets and catalog items
- Added ValidityTime model and migration to manage ticket validity periods. - Updated TicketGeneratorService to resolve and assign validity times to tickets. - Refactored ticket generation logic to remove legacy date fields and use validity time. - Introduced timezone support for tenants to handle service dates correctly. - Updated migrations to remove deprecated columns and add foreign keys for validity times. - Modified seeders and tests to accommodate new validity time structure. - Enhanced tests to validate ticket generation and validity time behavior.
This commit is contained in:
@@ -32,14 +32,11 @@ class CatalogItemControllerTest extends TestCase
|
||||
'slug' => 'shirt',
|
||||
'nombre' => 'Shirt',
|
||||
'precio' => 100,
|
||||
'minimum_use_date' => '2026-08-01 09:00:00',
|
||||
'maximum_use_date' => '2026-08-31 18:00:00',
|
||||
'attribute_codes' => [$attribute->codigo],
|
||||
'images' => [$image, $image],
|
||||
'variants' => [
|
||||
[
|
||||
'real_stock' => 5,
|
||||
'maximum_use_date' => '2026-08-15 18:00:00',
|
||||
'values' => ['size' => 'M'],
|
||||
'images' => [$image],
|
||||
],
|
||||
@@ -51,20 +48,7 @@ class CatalogItemControllerTest extends TestCase
|
||||
->assertJsonPath('data.nombre', 'Shirt')
|
||||
->assertJsonCount(2, 'data.images')
|
||||
->assertJsonCount(1, 'data.variants')
|
||||
->assertJsonCount(1, 'data.variants.0.images')
|
||||
->assertJsonPath('data.variants.0.minimum_use_date', null)
|
||||
->assertJsonPath(
|
||||
'data.variants.0.maximum_use_date',
|
||||
fn (string $value): bool => str_starts_with($value, '2026-08-15T18:00:00'),
|
||||
)
|
||||
->assertJsonPath(
|
||||
'data.variants.0.effective_minimum_use_date',
|
||||
fn (string $value): bool => str_starts_with($value, '2026-08-01T09:00:00'),
|
||||
)
|
||||
->assertJsonPath(
|
||||
'data.variants.0.effective_maximum_use_date',
|
||||
fn (string $value): bool => str_starts_with($value, '2026-08-15T18:00:00'),
|
||||
);
|
||||
->assertJsonCount(1, 'data.variants.0.images');
|
||||
|
||||
$item = CatalogItem::query()->where('slug', 'shirt')->firstOrFail();
|
||||
$variant = $item->variants()->firstOrFail();
|
||||
|
||||
Reference in New Issue
Block a user