2020-05-09 18:00:07 +00:00
|
|
|
from flask_sqlalchemy import SQLAlchemy, orm
|
2020-05-21 11:20:27 +00:00
|
|
|
import uuid
|
2020-05-09 18:00:07 +00:00
|
|
|
|
|
|
|
db = SQLAlchemy() # type: SQLAlchemy
|
|
|
|
|
|
|
|
|
2020-05-21 11:20:27 +00:00
|
|
|
def generate_uuid():
|
|
|
|
return str(uuid.uuid4())
|
|
|
|
|
|
|
|
|
|
|
|
class OAuth(db.Model):
|
|
|
|
token = db.Column(db.Text, primary_key=True)
|
|
|
|
provider = db.Column(db.Text)
|
|
|
|
provider_username = db.Column(db.Text)
|
|
|
|
|
|
|
|
|
|
|
|
class User(db.Model):
|
|
|
|
id = db.Column(db.String(length=36), primary_key=True, default=generate_uuid)
|
|
|
|
username = db.Column(db.String, unique=True)
|
|
|
|
|
|
|
|
|
2020-05-09 18:00:07 +00:00
|
|
|
class Client(db.Model):
|
|
|
|
key = db.Column(db.Text, primary_key=True)
|
|
|
|
value = db.Column(db.Text)
|
|
|
|
|
|
|
|
|
|
|
|
class AuthzCode(db.Model):
|
|
|
|
key = db.Column(db.Text, primary_key=True)
|
|
|
|
value = db.Column(db.Text)
|
|
|
|
|
|
|
|
|
|
|
|
class AccessToken(db.Model):
|
|
|
|
key = db.Column(db.Text, primary_key=True)
|
|
|
|
value = db.Column(db.Text)
|
|
|
|
|
|
|
|
|
|
|
|
class RefreshToken(db.Model):
|
|
|
|
key = db.Column(db.Text, primary_key=True)
|
|
|
|
value = db.Column(db.Text)
|
|
|
|
|
|
|
|
|
|
|
|
class SubjectIdentifier(db.Model):
|
|
|
|
key = db.Column(db.Text, primary_key=True)
|
|
|
|
value = db.Column(db.Text)
|
|
|
|
|
|
|
|
|