From 5283599da2b3134c494ab2c8f547b1f17d7745f3 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sun, 8 Jul 2018 18:34:37 +0200 Subject: [PATCH] Create the Profile model It is capable of holding both local and remote profiles --- calsocial/models.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/calsocial/models.py b/calsocial/models.py index 63c8d5e..a512dfe 100644 --- a/calsocial/models.py +++ b/calsocial/models.py @@ -149,6 +149,27 @@ class Role(db.Model, RoleMixin): return f'' +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 """