-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Config endpoint returns only orgs that correspond to allowed corpora (#…
…426) * Config endpoint returns only orgs that correspond to allowed corpora * Bump patch version * Bump patch version again * Add missing param * Fix unit test * Undo * Return all orgs if allowed corpora list is empty * Remove commented out code
- Loading branch information
Showing
8 changed files
with
199 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
from fastapi import Depends, Request | ||
from typing import Annotated | ||
|
||
from fastapi import Depends, Header, Request | ||
|
||
from app.api.api_v1.routers.lookups.router import lookups_router | ||
from app.clients.db.session import get_db | ||
from app.models.metadata import ApplicationConfig | ||
from app.repository.lookups import get_config | ||
from app.service.custom_app import AppTokenFactory | ||
|
||
|
||
@lookups_router.get("/config", response_model=ApplicationConfig) | ||
def lookup_config(request: Request, db=Depends(get_db)): | ||
def lookup_config( | ||
request: Request, app_token: Annotated[str, Header()], db=Depends(get_db) | ||
): | ||
"""Get the config for the metadata.""" | ||
return get_config(db) | ||
token = AppTokenFactory() | ||
token.decode_and_validate(db, request, app_token) | ||
|
||
return get_config(db, token.allowed_corpora_ids) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "navigator_backend" | ||
version = "1.19.17" | ||
version = "1.19.18" | ||
description = "" | ||
authors = ["CPR-dev-team <[email protected]>"] | ||
packages = [{ include = "app" }, { include = "tests" }] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters