From 1892c27476181daaa3f72022e5bbdf87e2dbd4d0 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 23 Apr 2018 21:10:01 -0700 Subject: release changelog --- fatcat/api.py | 8 ++++++++ fatcat/routes.py | 9 +++++++++ fatcat/templates/release_changelog.html | 17 +++++++++++++++++ tests/routes.py | 3 +++ 4 files changed, 37 insertions(+) create mode 100644 fatcat/templates/release_changelog.html 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//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//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 %} + +

Release Changelog: {{ release.id }}

+ +

release: {{ release.id }} + +

Changelog: +

+ +{% 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 -- cgit v1.2.3