Just do a "case" if for type in Compat API

This commit is contained in:
Mustafa Gezen 2023-02-02 19:08:43 +01:00
parent 55b1efa8e9
commit b66cef60e9
Signed by untrusted user who does not match committer: mustafa
GPG Key ID: DCDF010D946438C1
1 changed files with 10 additions and 1 deletions

View File

@ -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,
]
)