diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-06-02 17:38:14 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-06-02 17:38:14 +0200 |
| commit | f6d7fcbb50ef57f1f7d7ca8cacd711ffd576e600 (patch) | |
| tree | 9d6a4882d428da7098c4244f5ca56267afe8cc1b /cli/app/controllers/graph_controller.py | |
| parent | 5b480258322682fdc4fa987770df9e719315f167 (diff) | |
showing pages for graph. getting urls right
Diffstat (limited to 'cli/app/controllers/graph_controller.py')
| -rw-r--r-- | cli/app/controllers/graph_controller.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cli/app/controllers/graph_controller.py b/cli/app/controllers/graph_controller.py index 25b49aa..3fa4cce 100644 --- a/cli/app/controllers/graph_controller.py +++ b/cli/app/controllers/graph_controller.py @@ -16,3 +16,23 @@ class GraphView(CrudView): for item in item.pages: session.query(Tile).filter(Tile.page_id == item.id).delete(synchronize_session=False) session.query(Page).filter(Page.graph_id == item.id).delete(synchronize_session=False) + + @route('/name/<path>', methods=['GET']) + def get_name(self, path: str): + """ + Fetch a single {model}. + """ + session = Session() + item = session.query(self.model).filter(self.model.path == path).first() + if not item: + session.close() + return jsonify({ + 'status': 'error', + 'error': 'item not found' + }) + result = { + 'status': 'ok', + 'res': item.toFullJSON() if hasattr(item, 'toFullJSON') else item.toJSON(), + } + session.close() + return jsonify(result) |
