2022-06-10 16:43:10 +02:00
|
|
|
from .models import App, AppRole
|
|
|
|
|
|
|
|
class AppsService:
|
|
|
|
@staticmethod
|
2022-07-12 00:12:33 +02:00
|
|
|
def get_all_apps():
|
2022-06-10 16:43:10 +02:00
|
|
|
apps = App.query.all()
|
2022-10-04 12:35:56 +02:00
|
|
|
return [app.to_dict() for app in apps]
|
2022-09-23 19:04:29 +02:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def get_app(slug):
|
|
|
|
app = App.query.filter_by(slug=slug).first()
|
2022-10-04 12:35:56 +02:00
|
|
|
return app.to_dict()
|
2022-09-23 19:04:29 +02:00
|
|
|
|
2022-06-10 16:43:10 +02:00
|
|
|
@staticmethod
|
|
|
|
def get_app_roles():
|
|
|
|
app_roles = AppRole.query.all()
|
2022-09-27 15:41:46 +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]
|