From 01e79226a2ab28f202a1d774317f5edc6ca74e38 Mon Sep 17 00:00:00 2001 From: Carson Davis Date: Thu, 22 Feb 2024 13:43:49 -0600 Subject: [PATCH 1/2] add indexing instructions endpoint --- sde_collections/urls.py | 5 +++++ sde_collections/views.py | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/sde_collections/urls.py b/sde_collections/urls.py index 3953517e..261207af 100644 --- a/sde_collections/urls.py +++ b/sde_collections/urls.py @@ -25,6 +25,11 @@ views.PushToGithubView.as_view(), name="push-to-github", ), + path( + "api/indexing_instructions/", + views.IndexingInstructionsView.as_view(), + name="indexing_instructions", + ), path( "delete-required-url/", view=views.RequiredUrlsDeleteView.as_view(), diff --git a/sde_collections/views.py b/sde_collections/views.py index 6d65d61e..2a908281 100644 --- a/sde_collections/views.py +++ b/sde_collections/views.py @@ -351,6 +351,23 @@ def post(self, request): ) +class IndexingInstructionsView(APIView): + def get(self, request): + curated_collections = Collection.objects.filter(workflow_status=WorkflowStatusChoices.CURATED) + + job_name = "" + if curated_collections.exists(): + collection = curated_collections.first() + job_name = f"collection.indexer.{collection.config_folder}.xml" + + return Response( + { + "job_name": job_name, + }, + status=status.HTTP_200_OK, + ) + + class WebappGitHubConsolidationView(LoginRequiredMixin, TemplateView): """ Display a list of collections in the system From 497c88a81490232384ba85a8a0fd04b962d69c4d Mon Sep 17 00:00:00 2001 From: Carson Davis Date: Thu, 22 Feb 2024 13:49:50 -0600 Subject: [PATCH 2/2] add docstring for IndexingInstructionsView --- sde_collections/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sde_collections/views.py b/sde_collections/views.py index 2a908281..5e815a3e 100644 --- a/sde_collections/views.py +++ b/sde_collections/views.py @@ -352,6 +352,10 @@ def post(self, request): class IndexingInstructionsView(APIView): + """ + Serves the name of the first curated collection to be indexed + """ + def get(self, request): curated_collections = Collection.objects.filter(workflow_status=WorkflowStatusChoices.CURATED)