Skip to content

Commit

Permalink
Fix the Email reset ability
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Jul 7, 2024
1 parent 94655ff commit b24232b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
7 changes: 2 additions & 5 deletions app/Jobs/EmailTransformerJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace App\Jobs;

use App\Domains\Documents\StatusEnum;
use App\Domains\Documents\TypesEnum;
use App\Domains\EmailParser\MailDto;
use App\Domains\UnStructured\StructuredTypeEnum;
use Facades\App\Domains\Transformers\EmailTransformer;
use App\Models\Document;
use Facades\App\Domains\Transformers\EmailTransformer;
use Illuminate\Bus\Batchable;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
Expand All @@ -17,8 +15,8 @@

class EmailTransformerJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Batchable;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

/**
* Create a new job instance.
Expand Down Expand Up @@ -86,6 +84,5 @@ public function handle(): void
)));
}


}
}
3 changes: 1 addition & 2 deletions app/Jobs/ProcessFileJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function handle(): void
],
TypesEnum::Email->value => [
'jobs' => [
EmailTransformerJob::class
EmailTransformerJob::class,
],
'finally' => [
SummarizeDocumentJob::class,
Expand Down Expand Up @@ -102,7 +102,6 @@ public function handle(): void

$option = $options[$document->type->value];


Bus::batch(collect($option['jobs'])->map(function ($job) use ($document) {
return new $job($document);
})->toArray())
Expand Down
7 changes: 2 additions & 5 deletions tests/Feature/EmailTransformerJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@

use App\Domains\UnStructured\StructuredTypeEnum;
use App\Jobs\EmailTransformerJob;
use App\Jobs\VectorlizeDataJob;
use App\Models\Document;
use App\Models\DocumentChunk;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Queue;
use Tests\TestCase;

class EmailTransformerJobTest extends TestCase
{
/**
* A basic feature test example.
*/
public function test_reset() {
public function test_reset()
{
Bus::fake();
$meta_data = get_fixture('email_meta_data.json');
$document = Document::factory()->create([
Expand Down
2 changes: 0 additions & 2 deletions tests/Feature/EmailTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,4 @@ public function test_transformer(): void
$this->assertCount(8, $transformer->document_chunks);

}


}

0 comments on commit b24232b

Please sign in to comment.