You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
950 B

from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class VAPIDKey(db.Model):
id = db.Column(db.Integer, primary_key=True)
public_key = db.Column(db.String(255), nullable=False)
private_key = db.Column(db.String(255), nullable=False)
subscriptions = db.relationship('Subscription', backref='vapid_key', lazy=True)
class Settings(db.Model):
id = db.Column(db.Integer, primary_key=True)
prev_notify_end_time = db.Column(db.String(29), nullable=False)
running_notify_end_time = db.Column(db.String(29), nullable=True)
class Subscription(db.Model):
id = db.Column(db.Integer, primary_key=True)
auth = db.Column(db.String(255), nullable=False)
endpoint = db.Column(db.String(500), nullable=False)
notify_time = db.Column(db.String(5), nullable=True) # HH:MM
p256dh = db.Column(db.String(255), nullable=False)
vapid_key_id = db.Column(db.Integer, db.ForeignKey('vapid_key.id'), nullable=False)