From 23c0c3ad3c57c1ac010ecfb3875b7162797d1df9 Mon Sep 17 00:00:00 2001 From: Simon Gaudreau Date: Fri, 13 Oct 2023 08:04:36 -0400 Subject: [PATCH] feat: wip - add Movie data fetcher --- app/Domain/Integrations/SWApi.php | 42 ++++++++++++ .../Movies/Jobs/MovieDataFetcherJob.php | 32 +++++++++ .../MovieDataFetcherController.php | 14 ++++ app/Providers/AppServiceProvider.php | 3 +- config/services.php | 4 ++ resources/js/Layouts/AuthenticatedLayout.vue | 68 ++++++++++++++++--- routes/web.php | 2 + 7 files changed, 155 insertions(+), 10 deletions(-) create mode 100644 app/Domain/Integrations/SWApi.php create mode 100644 app/Domain/Movies/Jobs/MovieDataFetcherJob.php create mode 100644 app/Http/Controllers/MovieDataFetcherController.php diff --git a/app/Domain/Integrations/SWApi.php b/app/Domain/Integrations/SWApi.php new file mode 100644 index 0000000..6e2db57 --- /dev/null +++ b/app/Domain/Integrations/SWApi.php @@ -0,0 +1,42 @@ +makeRequestBase(); + } + + /** + * @return \Illuminate\Http\Client\PendingRequest + */ + protected function makeRequestBase(): PendingRequest + { + return Http::timeout($this->timeout); + } +} diff --git a/app/Domain/Movies/Jobs/MovieDataFetcherJob.php b/app/Domain/Movies/Jobs/MovieDataFetcherJob.php new file mode 100644 index 0000000..5289125 --- /dev/null +++ b/app/Domain/Movies/Jobs/MovieDataFetcherJob.php @@ -0,0 +1,32 @@ +app->singleton(SWApi::class); } /** diff --git a/config/services.php b/config/services.php index 0ace530..872ac50 100644 --- a/config/services.php +++ b/config/services.php @@ -31,4 +31,8 @@ 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], + 'swapi' => [ + 'url' => env('SWAPI_URL', 'https://swapi.dev/api/'), + ] + ]; diff --git a/resources/js/Layouts/AuthenticatedLayout.vue b/resources/js/Layouts/AuthenticatedLayout.vue index 3b3cb6f..0cbca0e 100644 --- a/resources/js/Layouts/AuthenticatedLayout.vue +++ b/resources/js/Layouts/AuthenticatedLayout.vue @@ -1,13 +1,41 @@