Skip to content

Commit

Permalink
Save the payload from the webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Jun 11, 2023
1 parent 0f35b38 commit 347789d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
3 changes: 1 addition & 2 deletions app/Jobs/ProcessSourceListeners.php
Expand Up @@ -4,7 +4,6 @@

use App\Models\Document;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
Expand All @@ -31,8 +30,8 @@ public function handle(): void
* See if has attached Listeners
* If so queue those up
* else just return document
*
* @TODO how to trigger transformations
*/

}
}
5 changes: 2 additions & 3 deletions app/Source/Types/WebHook.php
Expand Up @@ -18,14 +18,13 @@ public function handle(): Document
'status' => StatusEnum::Complete,
'content' => json_encode($this->payload),
'meta_data' => [
'original_payload' => $this->payload
]
'original_payload' => $this->payload,
],
]
);

ProcessSourceListeners::dispatch($document);


return $document;
}
}
Expand Up @@ -3,7 +3,6 @@
namespace Tests\Feature\Http\Controllers;

use App\Jobs\ProcessSourceJob;
use App\Jobs\ProcessSourceListeners;
use App\Models\Project;
use App\Models\Source;
use App\Models\User;
Expand Down
7 changes: 1 addition & 6 deletions tests/Feature/WebHookTest.php
Expand Up @@ -5,20 +5,16 @@
use App\Jobs\ProcessSourceListeners;
use App\Models\Source;
use App\Source\Types\WebHook;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\Storage;
use Mockery;
use Tests\TestCase;

class WebHookTest extends TestCase
{

public function test_makes_document()
{

Queue::fake();
$data = get_fixture("github_webhook.json");
$data = get_fixture('github_webhook.json');

$source = Source::factory()
->webHook()
Expand All @@ -34,5 +30,4 @@ public function test_makes_document()

Queue::assertPushed(ProcessSourceListeners::class);
}

}

0 comments on commit 347789d

Please sign in to comment.