diff --git a/app/Domains/Tenant/Resources/TenantResource.php b/app/Domains/Tenant/Resources/TenantResource.php index b68a8b2..da71d67 100644 --- a/app/Domains/Tenant/Resources/TenantResource.php +++ b/app/Domains/Tenant/Resources/TenantResource.php @@ -6,9 +6,7 @@ use App\Domains\Attachable\Models\Attachment; use App\Domains\Attachable\Models\AttachmentCrop; use App\Domains\Catalog\Models\Category; use App\Domains\Event\Models\EventDate; -use App\Domains\Event\Resources\EventDateChangeResource; use App\Domains\Event\Services\EventDateInfoFormatter; -use App\Domains\Event\Services\EventDateNoticeFormatter; use App\Domains\Menu\Models\Menu; use App\Domains\Tenant\Models\Tenant; use Illuminate\Http\Request; @@ -71,14 +69,6 @@ class TenantResource extends JsonResource ), 'isCanceled' => $eventDate->suspended_at !== null, ])->values(), - 'date_changes' => $this->whenLoaded( - 'eventDateChanges', - fn () => EventDateChangeResource::collection($this->eventDateChanges) - ), - 'date_notices' => $this->whenLoaded( - 'eventDateChanges', - fn () => app(EventDateNoticeFormatter::class)->format($this->eventDateChanges) - ), ]), 'extras' => $this->whenLoaded( 'websiteExtras', diff --git a/tests/Feature/Event/AdminAppEventControllerTest.php b/tests/Feature/Event/AdminAppEventControllerTest.php index e5431e9..dc53366 100644 --- a/tests/Feature/Event/AdminAppEventControllerTest.php +++ b/tests/Feature/Event/AdminAppEventControllerTest.php @@ -374,21 +374,8 @@ class AdminAppEventControllerTest extends TestCase ->assertJsonPath('data.event.dates.0.id', $destination->id) ->assertJsonPath('data.event.dates.0.info_text', '09/10/2027 se reprogramó para este día.') ->assertJsonPath('data.event.dates.0.isCanceled', false) - ->assertJsonCount(1, 'data.event.date_changes') - ->assertJsonPath('data.event.date_changes.0.type', 'rescheduled') - ->assertJsonPath('data.event.date_changes.0.source_event_date_id', $original->id) - ->assertJsonPath('data.event.date_changes.0.destination_event_date_id', $destination->id) - ->assertJsonPath('data.event.date_changes.0.previous_date', '2027-10-09') - ->assertJsonPath('data.event.date_changes.0.new_date', '2027-10-20') - ->assertJsonPath('data.event.date_changes.0.occurred_at', fn ($value) => is_string($value)) - ->assertJsonMissingPath('data.event.date_changes.0.created_by_user_id') - ->assertJsonCount(1, 'data.event.date_notices') - ->assertJsonPath('data.event.date_notices.0.type', 'rescheduled') - ->assertJsonPath('data.event.date_notices.0.title', 'FECHA REPROGRAMADA!') - ->assertJsonPath('data.event.date_notices.0.message.0.text', 'La fecha del ') - ->assertJsonPath('data.event.date_notices.0.message.1.text', '09 de Octubre de 2027') - ->assertJsonPath('data.event.date_notices.0.message.1.bold', true) - ->assertJsonPath('data.event.date_notices.0.message.3.text', '20 de Octubre de 2027') + ->assertJsonMissingPath('data.event.date_changes') + ->assertJsonMissingPath('data.event.date_notices') ->assertJsonPath('data.event_date_text', '20 de Octubre 2027'); $this->assertSame( '2027-10-20 11:00:00', @@ -425,15 +412,8 @@ class AdminAppEventControllerTest extends TestCase ->assertOk() ->assertJsonCount(1, 'data.event.dates') ->assertJsonPath('data.event.dates.0.date', '2027-10-25') - ->assertJsonCount(2, 'data.event.date_changes') - ->assertJsonPath('data.event.date_changes.1.type', 'rescheduled') - ->assertJsonPath('data.event.date_changes.1.previous_date', '2027-10-20') - ->assertJsonPath('data.event.date_changes.1.new_date', '2027-10-25') - ->assertJsonPath('data.event.date_notices.0.title', 'FECHAS REPROGRAMADAS!') - ->assertJsonPath('data.event.date_notices.0.message.1.text', '09 y 20 de Octubre de 2027') - ->assertJsonPath('data.event.date_notices.0.message.3.text', '20 y 25 de Octubre de 2027') - ->assertJsonPath('data.event.date_notices.0.message.5.text', 'respectivamente') - ->assertJsonPath('data.event.date_notices.0.message.5.bold', true) + ->assertJsonMissingPath('data.event.date_changes') + ->assertJsonMissingPath('data.event.date_notices') ->assertJsonPath('data.event_date_text', '25 de Octubre 2027'); $this->assertSame( '2027-10-25 11:00:00', @@ -538,18 +518,8 @@ class AdminAppEventControllerTest extends TestCase ->assertJsonPath('data.event.dates.1.id', $otherDate->id) ->assertJsonPath('data.event.dates.1.info_text', null) ->assertJsonPath('data.event.dates.1.isCanceled', false) - ->assertJsonCount(1, 'data.event.date_changes') - ->assertJsonPath('data.event.date_changes.0.type', 'suspended') - ->assertJsonPath('data.event.date_changes.0.source_event_date_id', $suspendedDate->id) - ->assertJsonPath('data.event.date_changes.0.destination_event_date_id', null) - ->assertJsonPath('data.event.date_changes.0.previous_date', '2027-10-09') - ->assertJsonPath('data.event.date_changes.0.new_date', null) - ->assertJsonMissingPath('data.event.date_changes.0.created_by_user_id') - ->assertJsonCount(1, 'data.event.date_notices') - ->assertJsonPath('data.event.date_notices.0.type', 'suspended') - ->assertJsonPath('data.event.date_notices.0.title', 'FECHA CANCELADA!') - ->assertJsonPath('data.event.date_notices.0.message.1.text', '09 de Octubre de 2027') - ->assertJsonPath('data.event.date_notices.0.message.1.bold', true) + ->assertJsonMissingPath('data.event.date_changes') + ->assertJsonMissingPath('data.event.date_notices') ->assertJsonPath('data.event_date_text', '10 de Octubre 2027'); $this->assertSame( '2027-10-10 09:00:00',