コード例 #1
0
class User(UserMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(100), unique=True)
    password = db.Column(db.String(100))
    username = db.Column(db.String(100), unique=True)
    score = db.relationship('Score', backref="user_score", uselist=False)
    solve = db.relationship('Solve', backref="user_solve")
コード例 #2
0
class Challenge(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100))
    value = db.Column(db.Integer)
    requirement = db.Column(db.Integer)
    solves = db.Column(db.Integer, default=0)
    desc = db.Column(db.String(300))
    link = db.Column(db.String(300))
    base_flag = db.Column(db.String(100))
    cur_flag = db.Column(db.String(100))
    category_id = db.Column(db.String, db.ForeignKey('category.name'))
    solve = db.relationship("Solve", backref="challenge_solve")
コード例 #3
0
class Category(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100), unique=True)
    challenges = db.relationship("Challenge", backref="category_challenge")
コード例 #4
0
class Solve(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String, db.ForeignKey('user.username'))
    challenge = db.Column(db.String, db.ForeignKey('challenge.name'))
    solved = db.Column(db.Boolean, default=False)
コード例 #5
0
class Score(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    score = db.Column(db.Integer, default=0)
    username = db.Column(db.String, db.ForeignKey('user.username'))