From b66cef60e99cb1a6efa887188978aaa3d5716707 Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Thu, 2 Feb 2023 19:08:43 +0100 Subject: [PATCH] Just do a "case" if for type in Compat API --- apollo/server/routes/api_compat.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apollo/server/routes/api_compat.py b/apollo/server/routes/api_compat.py index 876e14d..00c07c6 100644 --- a/apollo/server/routes/api_compat.py +++ b/apollo/server/routes/api_compat.py @@ -187,6 +187,15 @@ async def fetch_advisories_compat( except: raise RenderErrorTemplateException("Invalid after date", 400) # noqa # pylint: disable=raise-missing-from + q_kind = kind + if q_kind: + if q_kind == "TYPE_BUGFIX": + q_kind = "Bug Fix" + elif q_kind == "TYPE_ENHANCEMENT": + q_kind = "Enhancement" + elif q_kind == "TYPE_SECURITY": + q_kind = "Security" + a = """ with vars (search, size, page_offset, product, before, after, cve, synopsis, severity, kind) as ( values ($1 :: text, $2 :: bigint, $3 :: bigint, $4 :: text, $5 :: timestamp, $6 :: timestamp, $7 :: text, $8 :: text, $9 :: text, $10 :: text) @@ -242,7 +251,7 @@ async def fetch_advisories_compat( cve, synopsis, severity, - kind.upper() if kind else kind, + q_kind, ] )