Skip to content

Commit

Permalink
chore: use internal router
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-schultz committed Aug 8, 2024
1 parent a0e9812 commit 43bd56f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
8 changes: 4 additions & 4 deletions api/registry/api/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@

router = Router()

analytics_router = Router()


@router.get(
"/signing-message",
Expand Down Expand Up @@ -330,6 +328,9 @@ def get_score(request, address: str, scorer_id: int) -> DetailedScoreResponse:
return v1.get_score(request, address, scorer_id)


internal_router = Router()


class DataScienceApiKey(APIKeyHeader):
param_name = "AUTHORIZATION"

Expand All @@ -349,7 +350,7 @@ class BatchResponse(Schema):
percentage_complete: int


@router.get(
@internal_router.get(
"/analysis/internal",
auth=data_science_auth,
response={
Expand All @@ -359,7 +360,6 @@ class BatchResponse(Schema):
},
summary="Retrieve batch scoring status and result",
description="Retrieve batch scoring status and result",
tags=["Passport Analysis"],
)
def get_batch_analysis_stats(request, limit: int = 10) -> list[BatchResponse]:
requests = BatchModelScoringRequest.objects.order_by("-created_at")[:limit]
Expand Down
2 changes: 1 addition & 1 deletion api/registry/test/test_data_science_bulk_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def batch_requests():
return requests


api_url = "/registry/v2/analysis/internal"
api_url = "/internal/analysis/internal"


def test_get_batch_analysis_stats_success(client, mock_s3_client, batch_requests):
Expand Down
4 changes: 4 additions & 0 deletions api/scorer/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from passport_admin.api import router as passport_admin_router
from registry.api.v1 import feature_flag_router
from registry.api.v1 import router as registry_router_v1
from registry.api.v2 import internal_router
from registry.api.v2 import router as registry_router_v2


Expand Down Expand Up @@ -121,6 +122,9 @@ def service_unavailable(request, _):
passport_admin_api = NinjaAPI(urls_namespace="passport-admin", docs_url=None)
passport_admin_api.add_router("", passport_admin_router)

internal_api = NinjaAPI(urls_namespace="internal", docs_url=None)
internal_api.add_router("", internal_router)


apis = [
registry_api_v1,
Expand Down
5 changes: 4 additions & 1 deletion api/scorer/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
"""

# from rest_framework.schemas import get_schema_view
from account.api import health
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import include, path

from account.api import health

from .api import (
ceramic_cache_api_v1,
feature_flag_api,
internal_api,
passport_admin_api,
registry_api_v1,
registry_api_v2,
Expand All @@ -45,6 +47,7 @@
path("account/", include("account.urls")),
path("social/", include("social_django.urls", namespace="social")),
path("passport-admin/", passport_admin_api.urls),
path("internal/", internal_api.urls),
# path("__debug__/", include("debug_toolbar.urls")),
path("trusta_labs/", include("trusta_labs.urls")),
path("stake/", include("stake.urls")),
Expand Down

0 comments on commit 43bd56f

Please sign in to comment.