1 Commits

Author SHA1 Message Date
06c7b2ea52 Add the Response model
This is to store RSVPs.
2018-07-12 12:22:49 +02:00

View File

@@ -103,6 +103,24 @@ class ResponseType(Enum):
return Enum.__eq__(self, other) return Enum.__eq__(self, other)
class EventAvailability(Enum):
free = 0
busy = 1
class UserAvailability(EventAvailability):
tentative = 2
class ResponseVisibility(Enum):
private = 0
organisers = 1
attendees = 2
followers = 3
friends = 4
public = 5
class SettingsProxy: class SettingsProxy:
"""Proxy object to get settings for a user """Proxy object to get settings for a user
""" """
@@ -310,21 +328,6 @@ class Profile(db.Model): # pylint: disable=too-few-public-methods
.filter(UserFollow.followed == self) \ .filter(UserFollow.followed == self) \
.filter(UserFollow.accepted_at.isnot(None)) .filter(UserFollow.accepted_at.isnot(None))
@property
def friend_list(self):
"""List of friends (ie. where both profiles follow each other)
"""
# This will always be empty for remote profiles
if not self.user:
return []
reverse = db.aliased(UserFollow)
return UserFollow.query \
.filter(UserFollow.follower == self) \
.join(reverse, UserFollow.followed == reverse.follower) \
.filter(UserFollow.follower == reverse.followed)
@property @property
def url(self): def url(self):
"""Get the URL for this profile """Get the URL for this profile