relationship.py 671 B

123456789101112131415161718192021
  1. from flask import Blueprint
  2. from apps.deploy.models import App
  3. from apps.configuration.models import Service
  4. from libs.tools import json_response
  5. from apps.configuration.models import AppConfigRel
  6. from libs.decorators import require_permission
  7. blueprint = Blueprint(__name__, __name__)
  8. @blueprint.route('/', methods=['GET'])
  9. @require_permission('config_app_rel_view')
  10. def get():
  11. apps = App.query.all()
  12. services = Service.query.all()
  13. relations = AppConfigRel.query.all()
  14. return json_response({
  15. 'apps': [x.to_json() for x in apps],
  16. 'services': [x.to_json() for x in services],
  17. 'relations': [x.to_json() for x in relations]
  18. })