Skip to content

Commit

Permalink
Merge pull request #627 from NASA-IMPACT/626-webapp-api-endpoint-to-s…
Browse files Browse the repository at this point in the history
…erve-indexing-instructions

add indexing instructions endpoint
  • Loading branch information
bishwaspraveen authored Feb 22, 2024
2 parents f0e3c4a + 497c88a commit 6757c53
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sde_collections/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/<int:pk>",
view=views.RequiredUrlsDeleteView.as_view(),
Expand Down
21 changes: 21 additions & 0 deletions sde_collections/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6757c53

Please sign in to comment.