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..5e815a3e 100644 --- a/sde_collections/views.py +++ b/sde_collections/views.py @@ -351,6 +351,27 @@ 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) + + 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