示例#1
0
class Application(db.Model):
    __tablename__ = 'applications'

    id = db.Column(db.INTEGER, primary_key=True, autoincrement=True)
    name = db.Column(db.String)

    def __init__(self, name):
        self.name = name

    def __repr__(self):
        return Application
示例#2
0
class User(db.Model):
    """定义数据模型"""
    __tablename__ = 'users'
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(80), unique=True)
    email = db.Column(db.String(120), unique=True)

    def __init__(self, username, email):
        self.username = username
        self.email = email

    def __repr__(self):
        return '<User %r>' % self.username
示例#3
0
class UserApplicationRoles(db.Model):
    __tablename__ = 'userapproles'

    userID = db.Column(db.INTEGER, db.ForeignKey('users.id'), primary_key=True)
    applicationID = db.Column(db.INTEGER, db.ForeignKey('applications.id'), primary_key=True)
    role = db.Column(db.INTEGER)

    def __init__(self, userID, applicationID, role):
        self.userId = userID
        self.applicationID = applicationID
        self.role = role

    def __repr__(self):
        return UserApplicationRoles
示例#4
0
class UserGroupRoles(db.Model):
    __tablename__ = 'usergrouproles'

    userID = db.Column(db.INTEGER, db.ForeignKey('users.id'), primary_key=True)
    groupID = db.Column(db.INTEGER,
                        db.ForeignKey('groups.id'),
                        primary_key=True)
    role = db.Column(db.INTEGER)

    def __init__(self, userID, groupID, role):
        self.userId = userID
        self.groupID = groupID
        self.role = role

    def __repr__(self):
        return UserGroupRoles
示例#5
0
class ApplicationGroup(db.Model):
    __tablename__ = 'appgroups'

    applicationID = db.Column(db.INTEGER,
                              db.ForeignKey('applications.id'),
                              primary_key=True)
    groupID = db.Column(db.INTEGER,
                        db.ForeignKey('groups.id'),
                        primary_key=True)

    def __init__(self, applicationID, groupID):
        self.applicationID = applicationID
        self.groupID = groupID

    def __repr__(self):
        return ApplicationGroup
示例#6
0
class Training(db.Model):
    index = db.Column(db.Integer, primary_key=True)
    created = db.Column(db.DateTime, default=datetime.datetime.utcnow)
    # ImageData object of the image
    image_data = db.Column(db.PickleType, nullable=False)
    # Distance sensor reading
    ultrasonic = db.Column(db.Float, nullable=False, default=0)
    # Boolean of what command was issued at this input
    cmd_forward = db.Column(db.Boolean, default=False)
    cmd_right = db.Column(db.Boolean, default=False)
    cmd_left = db.Column(db.Boolean, default=False)
    # What was the move number for this command (reset when server restarted)
    moves = db.Column(db.Integer)
    # whether this data was human-acquired, or faked
    real_data = db.Column(db.Boolean, default=True)