Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| GenerateVrsyncFeedJob | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| handle | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace ImovelZapAi\Publishing\Connectors\GroupOlx\Infrastructure\Jobs; |
| 6 | |
| 7 | use Illuminate\Bus\Queueable; |
| 8 | use Illuminate\Contracts\Queue\ShouldQueue; |
| 9 | use Illuminate\Foundation\Bus\Dispatchable; |
| 10 | use Illuminate\Queue\InteractsWithQueue; |
| 11 | use Illuminate\Queue\SerializesModels; |
| 12 | use ImovelZapAi\Publishing\Connectors\GroupOlx\Application\Actions\GenerateVrsyncFeedAction; |
| 13 | use ImovelZapAi\Tenancy\Support\TenantContext; |
| 14 | |
| 15 | /** |
| 16 | * Worker: PropertyChanged → Mapper → Builder → Validator → Storage → PublicationLog. |
| 17 | * |
| 18 | * Nunca roda durante request HTTP. |
| 19 | */ |
| 20 | final class GenerateVrsyncFeedJob implements ShouldQueue |
| 21 | { |
| 22 | use Dispatchable; |
| 23 | use InteractsWithQueue; |
| 24 | use Queueable; |
| 25 | use SerializesModels; |
| 26 | |
| 27 | public int $tries = 3; |
| 28 | |
| 29 | public function __construct( |
| 30 | public readonly string $tenantId, |
| 31 | public readonly ?int $triggeredBy = null, |
| 32 | ) { |
| 33 | $this->onQueue((string) config('publishing.queue', 'publishing')); |
| 34 | } |
| 35 | |
| 36 | public function handle(GenerateVrsyncFeedAction $generate): void |
| 37 | { |
| 38 | TenantContext::set($this->tenantId); |
| 39 | |
| 40 | $generate->execute($this->tenantId, $this->triggeredBy); |
| 41 | } |
| 42 | } |