Files
digiserver/models.py
2025-03-19 16:49:10 +02:00

23 lines
897 B
Python

from app import db
from flask_bcrypt import Bcrypt
bcrypt = Bcrypt()
class Content(db.Model):
id = db.Column(db.Integer, primary_key=True)
file_name = db.Column(db.String(120), nullable=False)
duration = db.Column(db.Integer, nullable=False)
player_id = db.Column(db.Integer, db.ForeignKey('player.id'), nullable=True)
group_id = db.Column(db.Integer, db.ForeignKey('group.id'), nullable=True)
class Player(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True, nullable=False)
hostname = db.Column(db.String(120), unique=True, nullable=False)
password = db.Column(db.String(120), nullable=False)
quickconnect_password = db.Column(db.String(120), nullable=False)
def verify_quickconnect_code(self, code):
return bcrypt.check_password_hash(self.quickconnect_password, code)
# other models...