Last active
June 18, 2019 01:05
-
-
Save zlavergne/70ccfbc46c77dbff0b5a3262ec50a898 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TeamMembers(db.Model): | |
__tablename__ = 'team_members' | |
team_id = db.Column(db.Integer, db.ForeignKey('teams.id', name='fk_teams'), primary_key=True) | |
user_id = db.Column(db.BigInteger, db.ForeignKey('users.id', name='fk_users'), primary_key=True) | |
function = db.Column(db.Integer, nullable=False) | |
member = db.relationship(User, backref='teams') | |
team = db.relationship('Team', backref='members') | |
class Team(db.Model): | |
""" Describes a team """ | |
__tablename__ = 'teams' | |
# Columns | |
id = db.Column(db.Integer, primary_key=True) | |
organisation_id = db.Column(db.Integer, db.ForeignKey('organisations.id', name='fk_organisations'), nullable=False) | |
name = db.Column(db.String(512), nullable=False) | |
logo = db.Column(db.String) # URL of a logo | |
description = db.Column(db.String) | |
invite_only = db.Column(db.Boolean, default=False, nullable=False) | |
visibility = db.Column(db.Integer, default=TeamVisibility.PUBLIC.value, nullable=False) | |
organisation = db.relationship(Organisation, backref='teams') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment