Esempio n. 1
0
class Task(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    true_picture_url = db.Column(db.String(512))
    false_picture_url = db.Column(db.String(512))

    def set_true_picture(self, true_picture_url):
        self.true_picture_url = true_picture_url

    def set_false_picture(self, false_picture_url):
        self.false_picture_url = false_picture_url
Esempio n. 2
0
class Training(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    provider = db.Column(db.String(60), nullable=False)
    title = db.Column(db.String(60), nullable=False)
    date_taken = db.Column(db.Date, nullable=False, default=datetime.utcnow)
    rating = db.Column(db.String(60), nullable=False)
    review = db.Column(db.Text)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

    def __repr__(self):
        return f"Training('{self.provider}', '{self.title}')"
Esempio n. 3
0
class Discipline(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(30), unique=True, nullable=False)
    interest_id = db.relationship('Interest', backref='discint', lazy=True)

    def __repr__(self):
        return f"Discipline('{self.name}')"
Esempio n. 4
0
class Level(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    level = db.Column(db.String(30), unique=True, nullable=False)
    user_id = db.relationship('User', backref='userlevel', lazy=True)

    def __repr__(self):
        return f"Level('{self.id}')"
Esempio n. 5
0
class Role(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(30), unique=True, nullable=False)
    user_id = db.relationship('User', backref='userrole', lazy=True)

    def __repr__(self):
        return f"Role('{self.title}')"
Esempio n. 6
0
class Interest(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(30), unique=True, nullable=False)
    discipline = db.Column(db.Integer,
                           db.ForeignKey('discipline.id'),
                           nullable=False)
    users = db.relationship('User', secondary='link')

    def __repr__(self):
        return f"Interest('{self.id}, {self.name}, {self.discipline}')"
Esempio n. 7
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(120), unique=True, nullable=False)
    training = db.relationship('Training', backref='usertrain', lazy=True)
    role = db.Column(db.Integer, db.ForeignKey('role.id'), nullable=False)
    level = db.Column(db.Integer, db.ForeignKey('level.id'), nullable=False)
    interests = db.relationship('Interest', secondary='link')

    def __repr__(self):
        return f"User('{self.email}')"