feat: version for scores
This commit is contained in:
@@ -2,6 +2,8 @@ from django.conf import settings
|
||||
from ninja import NinjaAPI
|
||||
from ninja.security import APIKeyHeader
|
||||
|
||||
from scores.api import router as scores_router
|
||||
|
||||
|
||||
class SecretKeyAuth(APIKeyHeader):
|
||||
param_name = "X-Secret-Key"
|
||||
@@ -12,6 +14,4 @@ class SecretKeyAuth(APIKeyHeader):
|
||||
|
||||
api = NinjaAPI(auth=SecretKeyAuth())
|
||||
|
||||
from scores.api import router as scores_router # noqa: E402
|
||||
|
||||
api.add_router("/scores", scores_router)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
from ninja import Router
|
||||
from pydantic import ConfigDict
|
||||
from pydantic.alias_generators import to_camel
|
||||
|
||||
|
||||
class BaseSchema:
|
||||
"""Mixin: camelCase aliases, accept snake_case on input too."""
|
||||
|
||||
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
||||
|
||||
|
||||
class CamelCaseRouter(Router):
|
||||
def add_api_operation(self, *args, **kwargs):
|
||||
kwargs["by_alias"] = True
|
||||
return super().add_api_operation(*args, **kwargs)
|
||||
@@ -11,6 +11,7 @@ class Settings(BaseSettings):
|
||||
django_secret_key: str = ""
|
||||
debug: bool = True
|
||||
allowed_hosts: list[str] = []
|
||||
installed_apps: list[str] = []
|
||||
api_secret: str = "selecta-secret"
|
||||
|
||||
db_engine: str = "django.db.backends.postgresql"
|
||||
|
||||
@@ -31,6 +31,7 @@ INSTALLED_APPS = [
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"scores",
|
||||
*env.installed_apps,
|
||||
]
|
||||
|
||||
API_SECRET = env.api_secret
|
||||
|
||||
Reference in New Issue
Block a user