Beispiel #1
0
class FriendshipInvite(db.Model):
    __tablename__ = 'friendship_invites'
    id = db.Column(db.Integer(), primary_key=True)

    friender_id = db.Column(db.Integer(),
                            db.ForeignKey('users.id', ondelete='CASCADE'),
                            nullable=False)
    friender = db.relationship("User", foreign_keys=[friender_id],
                               back_populates="friendship_invites")

    # info about the invite recipient, who may or may already already
    # have an account (e.g. 0)
    friendee_id = db.Column(db.Integer(),
                            db.ForeignKey('users.id', ondelete='CASCADE'),
                            nullable=True) # this is null or 0 if
                                           # friendee doesn't yet have
                                           # account
    # can be null if an existing account
    friendee_email = db.Column(db.String(50), nullable=True, server_default='')
    friendee = db.relationship("User", foreign_keys=[friendee_id],
                               back_populates="cofriendship_invites")

    # if friendship is confirmed
    confirmed_at = db.Column(db.DateTime(), nullable=True) 

    invited_at = db.Column(db.DateTime(), nullable=True) 
Beispiel #2
0
class User(db.Model, UserMixin):
    __tablename__ = 'users'
    id = db.Column(db.Integer, primary_key=True)

    # User authentication information (required for Flask-User)
    email = db.Column(db.Unicode(255),
                      nullable=False,
                      server_default=u'',
                      unique=True)
    confirmed_at = db.Column(db.DateTime())
    password = db.Column(db.String(255), nullable=False, server_default='')
    # reset_password_token = db.Column(db.String(100), nullable=False, server_default='')
    active = db.Column(db.Boolean(), nullable=False, server_default='0')

    # User information
    active = db.Column('is_active',
                       db.Boolean(),
                       nullable=False,
                       server_default='0')
    first_name = db.Column(db.Unicode(50), nullable=False, server_default=u'')
    last_name = db.Column(db.Unicode(50), nullable=False, server_default=u'')

    # Relationships
    roles = db.relationship('Role',
                            secondary='users_roles',
                            backref=db.backref('users', lazy='dynamic'))
Beispiel #3
0
class GraphRevision(db.Model):
    __tablename__ = 'graph_revisions'
    id = db.Column(db.Integer(), primary_key=True)
    nodes = db.Column(db.String(10 * 1000), nullable=False, server_default='')
    edges = db.Column(db.String(10 * 1000), nullable=False, server_default='')

    graph_id = db.Column(db.Integer(), db.ForeignKey('graphs.id'))
    graph = db.relationship('Graph', foreign_keys="GraphRevision.graph_id")

    previous_revision_id = db.Column(db.Integer(),
                                     db.ForeignKey('graph_revisions.id'))

    timestamp = db.Column(db.DateTime())

    author_id = db.Column(db.Integer(), db.ForeignKey('users.id'))
    author = db.relationship('User', foreign_keys=[author_id])
    
    def string(self):
        nodes = pickle.loads(str(self.nodes))
        edges = pickle.loads(str(self.edges))
        rv = ""
        rv += "\n".join('Node label: ' + str(node['label']) + "\nNode details: " +
                        str(node['detailed']) + "\n"
                        for node in nodes)
        rv += "\n".join('Edge detail: ' + str(edge['detailed']) for edge in edges)
        return rv
Beispiel #4
0
class Projects(db.Model):
    __tablename__ = 'projects'
    id = db.Column(db.Integer(), primary_key=True)
    url = db.Column(db.String(50), nullable=False, unique=True)
    json_http = db.Column(db.Text, nullable=True)
    json_https = db.Column(db.Text, nullable=True)
    json_last_updated = db.Column(db.DateTime())
    def __init__(self,url,json_http,json_https,json_last_updated):
        self.url = url
        self.json_http = json_http
        self.json_https = json_https
        self.json_last_updated = json_last_updated
Beispiel #5
0
class GraphViewRevision(db.Model):
    __tablename__ = 'graph_view_revisions'
    id = db.Column(db.Integer(), primary_key=True)

    graph_id = db.Column(db.Integer(), db.ForeignKey('graphs.id'))
    graph = db.relationship('Graph', foreign_keys=graph_id)
    
    author_id = db.Column(db.Integer(), db.ForeignKey('users.id'))
    author = db.relationship('User', foreign_keys=author_id)

    nodes = db.Column(db.String(10 * 1000), nullable=False, server_default='')
    edges = db.Column(db.String(10 * 1000), nullable=False, server_default='')

    timestamp = db.Column(db.DateTime())