dashboard/areas/apps/apps_service.py
2022-09-27 15:41:46 +02:00

18 lines
737 B
Python

from .models import App, AppRole
class AppsService:
@staticmethod
def get_all_apps():
apps = App.query.all()
return [{"id": app.id, "name": app.name, "slug": app.slug, "external": app.external, "url": app.get_url(), "status": app.get_status()} for app in apps]
@staticmethod
def get_app(slug):
app = App.query.filter_by(slug=slug).first()
return {"id": app.id, "name": app.name, "slug": app.slug, "external": app.external, "url": app.get_url(), "status": app.get_status()}
@staticmethod
def get_app_roles():
app_roles = AppRole.query.all()
return [{"user_id": app_role.user_id, "app_id": app_role.app_id, "role_id": app_role.role_id} for app_role in app_roles]