|
|
@ -1,7 +1,7 @@ |
|
|
|
from sqlalchemy.ext.associationproxy import association_proxy |
|
|
|
from sqlalchemy.ext.associationproxy import association_proxy |
|
|
|
|
|
|
|
|
|
|
|
from app import db |
|
|
|
from app import db |
|
|
|
from app.models import Role, NotificationPlayer, PlayerFoundObjective |
|
|
|
from app.models import Role, NotificationPlayer, PlayerFoundObjective, PlayerCaughtPlayer |
|
|
|
|
|
|
|
|
|
|
|
class GamePlayer(db.Model): |
|
|
|
class GamePlayer(db.Model): |
|
|
|
__tablename__ = 'game_player' |
|
|
|
__tablename__ = 'game_player' |
|
|
@ -26,3 +26,18 @@ class GamePlayer(db.Model): |
|
|
|
found_objectives = association_proxy('player_found_objectives', 'objective', |
|
|
|
found_objectives = association_proxy('player_found_objectives', 'objective', |
|
|
|
creator=lambda objective: PlayerFoundObjective(objective=objective)) |
|
|
|
creator=lambda objective: PlayerFoundObjective(objective=objective)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
player_caught_players = db.relationship( |
|
|
|
|
|
|
|
'PlayerCaughtPlayer', |
|
|
|
|
|
|
|
back_populates='catching_player', |
|
|
|
|
|
|
|
cascade='save-update, merge, delete, delete-orphan', |
|
|
|
|
|
|
|
foreign_keys=[PlayerCaughtPlayer.catching_player_id]) |
|
|
|
|
|
|
|
caught_players = association_proxy('player_caught_players', 'game_player', |
|
|
|
|
|
|
|
creator=lambda game_player: PlayerCaughtPlayer(caught_player=game_player)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
player_caught_by_players = db.relationship( |
|
|
|
|
|
|
|
'PlayerCaughtPlayer', |
|
|
|
|
|
|
|
back_populates='caught_player', |
|
|
|
|
|
|
|
cascade='save-update, merge, delete, delete-orphan', |
|
|
|
|
|
|
|
foreign_keys=[PlayerCaughtPlayer.caught_player_id]) |
|
|
|
|
|
|
|
caught_by_players = association_proxy('player_caught_by_players', 'game_player', |
|
|
|
|
|
|
|
creator=lambda game_player: PlayerCaughtPlayer(catching_player=game_player)) |
|
|
|