dashboard/backend/areas/apps/apps_service.py

22 lines
806 B
Python
Raw Normal View History

2022-10-21 12:44:34 +02:00
from .models_lit import LITApp
2022-10-21 12:44:04 +02:00
from .models import App, AppRole
class AppsService:
@staticmethod
def get_all_apps():
2022-10-21 12:44:34 +02:00
apps = [
LITApp(id=1, name="Dateiablage", slug="nextcloud", external=True, url="https://cloud.dev.local-it.cloud"),
LITApp(id=2, name="Projekte", slug="vikunja", external=True, url="https://vikunja.dev.local-it.cloud"),
]
# App.query.all()
2022-10-21 12:44:04 +02:00
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()
2022-10-21 12:44:34 +02:00
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]