|
|
@ -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 |
|
|
|
from app.models import Role, NotificationPlayer, PlayerFoundObjective |
|
|
|
|
|
|
|
|
|
|
|
class GamePlayer(db.Model): |
|
|
|
class GamePlayer(db.Model): |
|
|
|
__tablename__ = 'game_player' |
|
|
|
__tablename__ = 'game_player' |
|
|
@ -18,3 +18,11 @@ class GamePlayer(db.Model): |
|
|
|
cascade='save-update, merge, delete, delete-orphan') |
|
|
|
cascade='save-update, merge, delete, delete-orphan') |
|
|
|
notifications = association_proxy('player_notifications', 'notification', |
|
|
|
notifications = association_proxy('player_notifications', 'notification', |
|
|
|
creator=lambda notification: NotificationPlayer(notification=notification)) |
|
|
|
creator=lambda notification: NotificationPlayer(notification=notification)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
player_found_objectives = db.relationship( |
|
|
|
|
|
|
|
'PlayerFoundObjective', |
|
|
|
|
|
|
|
back_populates='game_player', |
|
|
|
|
|
|
|
cascade='save-update, merge, delete, delete-orphan') |
|
|
|
|
|
|
|
found_objectives = association_proxy('player_found_objectives', 'objective', |
|
|
|
|
|
|
|
creator=lambda objective: PlayerFoundObjective(objective=objective)) |
|
|
|
|
|
|
|
|
|
|
|