diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-04-23 21:10:01 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-04-23 21:10:01 -0700 |
commit | 1892c27476181daaa3f72022e5bbdf87e2dbd4d0 (patch) | |
tree | 952a4492d3267f9b8408299bd01c283411bccbcb | |
parent | f13a9c26c7a894703b401f4898b3d5bb84282824 (diff) | |
download | fatcat-1892c27476181daaa3f72022e5bbdf87e2dbd4d0.tar.gz fatcat-1892c27476181daaa3f72022e5bbdf87e2dbd4d0.zip |
release changelog
-rw-r--r-- | fatcat/api.py | 8 | ||||
-rw-r--r-- | fatcat/routes.py | 9 | ||||
-rw-r--r-- | fatcat/templates/release_changelog.html | 17 | ||||
-rw-r--r-- | tests/routes.py | 3 |
4 files changed, 37 insertions, 0 deletions
diff --git a/fatcat/api.py b/fatcat/api.py index 77afef0a..95b82742 100644 --- a/fatcat/api.py +++ b/fatcat/api.py @@ -96,6 +96,14 @@ def api_release_create(): db.session.commit() return release_schema.jsonify(ident) +@app.route('/v0/release/<int:ident>/changelog', methods=['GET']) +def api_release_changelog(ident): + entries = ChangelogEntry.query\ + .join(ReleaseEdit.editgroup)\ + .filter(ReleaseEdit.ident_id==ident)\ + .all() + return changelogentry_schema.jsonify(entries, many=True) + @app.route('/v0/release/random', methods=['GET']) def api_release_random(): entity = ReleaseIdent.query.order_by(db.func.random()).first() diff --git a/fatcat/routes.py b/fatcat/routes.py index ba12043d..24fd5b18 100644 --- a/fatcat/routes.py +++ b/fatcat/routes.py @@ -30,6 +30,15 @@ def release_view(ident): entity = json.loads(rv.data.decode('utf-8')) return render_template('release_view.html', release=entity) +@app.route('/release/<int:ident>/changelog', methods=['GET']) +def release_changelog(ident): + rv = api.api_release_get(ident) + release = json.loads(rv.data.decode('utf-8')) + rv = api.api_release_changelog(ident) + changelog_entries = json.loads(rv.data.decode('utf-8')) + return render_template('release_changelog.html', release=release, + changelog_entries=changelog_entries) + @app.route('/release/random', methods=['GET']) def release_random(): rv = api.api_release_random() diff --git a/fatcat/templates/release_changelog.html b/fatcat/templates/release_changelog.html new file mode 100644 index 00000000..47526749 --- /dev/null +++ b/fatcat/templates/release_changelog.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% block body %} + +<h1>Release Changelog: {{ release.id }}</h1> + +<p>release: <a href="/release/{{ release.id }}">{{ release.id }}</a> + +<p>Changelog: +<ul> +{% for entry in changelog_entries %} + <li><a href="/editgroup/{{ entry.edit_group }}">Edit Group #{{ entry.edit_group }}</a> (on {{ entry.timestamp }}) +{% else %} +NONE +{% endfor %} +</ul> + +{% endblock %} diff --git a/tests/routes.py b/tests/routes.py index 5b9f0ca9..79d97fe4 100644 --- a/tests/routes.py +++ b/tests/routes.py @@ -42,6 +42,9 @@ def test_all_views(rich_app): rv = app.get('/release/random') assert rv.status_code == 302 + rv = app.get('/release/1/changelog') + assert rv.status_code == 200 + rv = app.get('/editgroup/1') assert rv.status_code == 200 |