sp-hydra-veil-core/core/controllers/SessionStateController.py

26 lines
551 B
Python

from core.models.session.SessionState import SessionState
class SessionStateController:
@staticmethod
def get(id: int):
return SessionState.find_by_id(id)
@staticmethod
def get_or_new(id: int):
session_state = SessionStateController.get(id)
if session_state is None:
return SessionState(id)
return session_state
@staticmethod
def exists(id: int):
return SessionState.exists(id)
@staticmethod
def update_or_create(session_state):
session_state.save()