Data loading over socket.

This commit is contained in:
luxick
2018-03-03 18:52:13 +01:00
parent 8516650af4
commit 25d237e81e
23 changed files with 155 additions and 37 deletions

View File

@@ -0,0 +1,19 @@
from dsst_server.data_access import sql, sql_func, mapping
from common import models
from playhouse import shortcuts
class ReadFunctions:
@staticmethod
def load_seasons(*_):
return [mapping.db_to_season(season) for season in sql.Season.select()]
@staticmethod
def load_seasons_all(*_):
return [shortcuts.model_to_dict(season, backrefs=True, max_depth=2) for season in sql.Season.select()]
@staticmethod
def load_players(*_):
return [mapping.db_to_player(player) for player in sql.Player.select()]