Skip to content

Commit

Permalink
frontend: migrate API projects namespace to flask-restx
Browse files Browse the repository at this point in the history
  • Loading branch information
nikromen committed Jul 13, 2023
1 parent 46ae367 commit e97587d
Show file tree
Hide file tree
Showing 4 changed files with 342 additions and 162 deletions.
11 changes: 11 additions & 0 deletions frontend/coprs_frontend/coprs/views/apiv3_ns/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import json
from http import HTTPStatus

import flask
import wtforms
import sqlalchemy
Expand Down Expand Up @@ -374,3 +376,12 @@ def rename_fields_helper(input_dict, replace):
for value in values:
output.add(new_key, value)
return output


def responser(result, status: HTTPStatus = HTTPStatus.OK):
"""
Make API response with status
"""
resp = flask.jsonify(result)
resp.status_code = status.value
return resp
2 changes: 0 additions & 2 deletions frontend/coprs_frontend/coprs/views/apiv3_ns/apiv3_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
from .json2form import get_form_compatible_data




apiv3_builds_ns = Namespace("build", description="Builds")
api.add_namespace(apiv3_builds_ns)

Expand Down
Loading

0 comments on commit e97587d

Please sign in to comment.