From 52020fe9768f6ff593629ea8abc7e22356e5fe26 Mon Sep 17 00:00:00 2001 From: Jake Dane <114460917+jakedane@users.noreply.github.com> Date: Mon, 8 May 2023 05:56:37 +0200 Subject: [PATCH] Add group creation date to issues and group json Through the json interface currently there is no way to find when a group was created. If an app for example uses /issues/vulnerable.json and needs this information it currently additionally has to download the group html for each group and parse the "Created date" from the html. This MR adds group.created as 'date' to the issues and group json so for example downloading /issues/vulnerable.json would include this information and no additional download for each group is needed. It uses Y-M-d date format same as is used for advisories creation date in package json. --- tracker/view/index.py | 1 + tracker/view/show.py | 1 + 2 files changed, 2 insertions(+) diff --git a/tracker/view/index.py b/tracker/view/index.py index 5891b11..c70ea58 100644 --- a/tracker/view/index.py +++ b/tracker/view/index.py @@ -90,6 +90,7 @@ def index_json(only_vulnerable=False): json_entry = OrderedDict() json_entry['name'] = group.name + json_entry['date'] = group.created.strftime('%Y-%m-%d') json_entry['packages'] = entry['pkgs'] json_entry['status'] = group.status.label json_entry['severity'] = group.severity.label diff --git a/tracker/view/show.py b/tracker/view/show.py index fd555df..515ff99 100644 --- a/tracker/view/show.py +++ b/tracker/view/show.py @@ -282,6 +282,7 @@ def show_group_json(avg): json_data = OrderedDict() json_data['name'] = group.name + json_data['date'] = group.created.strftime('%Y-%m-%d') json_data['packages'] = [package.pkgname for package in packages] json_data['status'] = group.status.label json_data['severity'] = group.severity.label