Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
71.43% |
5 / 7 |
|
33.33% |
1 / 3 |
CRAP | |
0.00% |
0 / 1 |
| ImportErrorModel | |
71.43% |
5 / 7 |
|
33.33% |
1 / 3 |
3.21 | |
0.00% |
0 / 1 |
| casts | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| newFactory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| job | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace ImovelZapAi\Importing\Infrastructure\Persistence\Eloquent; |
| 6 | |
| 7 | use Database\Factories\ImportErrorFactory; |
| 8 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 9 | use Illuminate\Database\Eloquent\Model; |
| 10 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
| 11 | use ImovelZapAi\Importing\Domain\Enums\ImportIssueSeverity; |
| 12 | use ImovelZapAi\Shared\Infrastructure\Persistence\Concerns\BelongsToTenant; |
| 13 | use ImovelZapAi\Shared\Infrastructure\Persistence\Concerns\HasUuidPrimaryKey; |
| 14 | |
| 15 | class ImportErrorModel extends Model |
| 16 | { |
| 17 | use BelongsToTenant; |
| 18 | use HasFactory; |
| 19 | use HasUuidPrimaryKey; |
| 20 | |
| 21 | protected $table = 'import_errors'; |
| 22 | |
| 23 | protected $fillable = [ |
| 24 | 'tenant_id', |
| 25 | 'import_job_id', |
| 26 | 'severity', |
| 27 | 'code', |
| 28 | 'external_id', |
| 29 | 'listing_index', |
| 30 | 'path', |
| 31 | 'message', |
| 32 | 'resolution', |
| 33 | 'status', |
| 34 | 'context', |
| 35 | ]; |
| 36 | |
| 37 | protected function casts(): array |
| 38 | { |
| 39 | return [ |
| 40 | 'severity' => ImportIssueSeverity::class, |
| 41 | 'context' => 'array', |
| 42 | 'listing_index' => 'integer', |
| 43 | ]; |
| 44 | } |
| 45 | |
| 46 | protected static function newFactory(): ImportErrorFactory |
| 47 | { |
| 48 | return ImportErrorFactory::new(); |
| 49 | } |
| 50 | |
| 51 | public function job(): BelongsTo |
| 52 | { |
| 53 | return $this->belongsTo(ImportJobModel::class, 'import_job_id'); |
| 54 | } |
| 55 | } |