Create the Profile model

It is capable of holding both local and remote profiles
This commit is contained in:
Gergely Polonkai 2018-07-08 18:34:37 +02:00
parent 12eb91d012
commit 5283599da2

View File

@ -149,6 +149,27 @@ class Role(db.Model, RoleMixin):
return f'<Role {self.id}({self.name})>'
class Profile(db.Model): # pylint: disable=too-few-public-methods
"""Database model for user profiles
"""
__tablename__ = 'profiles'
# pylint: disable=invalid-name
id = db.Column(db.Integer(), primary_key=True)
#: The ID of the local user this profile belongs to
user_id = db.Column(db.Integer(), db.ForeignKey('users.id'), nullable=True)
#: The username this profile belongs to. If ``None``, `user_id` must be set
username = db.Column(db.String(length=50), nullable=True)
#: The domain this profile originates from. If ``None``, `user_id` must be set
domain = db.Column(db.Unicode(length=100), nullable=True)
#: The display name
display_name = db.Column(db.Unicode(length=80), nullable=False)
class Event(db.Model):
"""Database model for events
"""