dashboard/backend/areas/apps/apps_service.py
Philipp Rothmann 4c6b7e4414 use db backend
2022-10-25 12:24:51 +02:00

19 lines
No EOL
564 B
Python

from .models_lit import LITApp
from .models import App, AppRole
from database import db
class AppsService:
@staticmethod
def get_all_apps():
apps = App.query.all()
return [app.to_dict() for app in apps]
@staticmethod
def get_app(slug):
app = App.query.filter_by(slug=slug).first()
return app.to_dict()
@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]