mirror of
https://github.com/resf/distro-tools.git
synced 2024-11-22 05:01:26 +00:00
Fix compat API get_advisory
This commit is contained in:
parent
aae5d1d57c
commit
6654d26083
@ -75,6 +75,10 @@ class Pagination(BasePage[T], Generic[T]):
|
|||||||
fields = {"items": {"alias": "advisories"}}
|
fields = {"items": {"alias": "advisories"}}
|
||||||
|
|
||||||
|
|
||||||
|
class AdvisoryResponse(BaseModel):
|
||||||
|
advisory: Advisory_Pydantic_V2
|
||||||
|
|
||||||
|
|
||||||
def v3_advisory_to_v2(
|
def v3_advisory_to_v2(
|
||||||
advisory: Advisory,
|
advisory: Advisory,
|
||||||
include_rpms=True,
|
include_rpms=True,
|
||||||
@ -370,7 +374,7 @@ async def list_advisories_compat_v2_rss(
|
|||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/{advisory_name}",
|
"/{advisory_name}",
|
||||||
response_model=Advisory_Pydantic_V2,
|
response_model=AdvisoryResponse,
|
||||||
)
|
)
|
||||||
async def get_advisory_compat_v2(advisory_name: str):
|
async def get_advisory_compat_v2(advisory_name: str):
|
||||||
advisory = await Advisory.filter(name=advisory_name).prefetch_related(
|
advisory = await Advisory.filter(name=advisory_name).prefetch_related(
|
||||||
@ -386,4 +390,6 @@ async def get_advisory_compat_v2(advisory_name: str):
|
|||||||
if not advisory:
|
if not advisory:
|
||||||
raise HTTPException(404)
|
raise HTTPException(404)
|
||||||
|
|
||||||
return Advisory_Pydantic_V2.from_orm(v3_advisory_to_v2(advisory))
|
return AdvisoryResponse(
|
||||||
|
advisory=Advisory_Pydantic_V2.from_orm(v3_advisory_to_v2(advisory))
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user