Esempio n. 1
0
class OAuth2AuthorizationCode(db.Model, OAuth2AuthorizationCodeMixin):
    __tablename__ = 'oauth2_code'

    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(
        db.Integer, db.ForeignKey('user.id', ondelete='CASCADE'))
    user = db.relationship('User')
Esempio n. 2
0
class ClientAskForLeaveSubFlow(StateMachineModel):
    id = db.Column(db.Integer, primary_key=True)
    client_id = db.Column(db.Integer, db.ForeignKey('state_machine_client.id'), unique=True)
    user = db.relationship(StateMachineClient, backref=db.backref("client_ask_for_leave_sub_flow", uselist=False))

    __states__ = (
        (0, "initial"),
        (1001, "processing"),
        (1002, "success"),
        (1003, "failed"),
    )

    __transitions__ = [
        {
            "trigger": "ask_for_leave",
            "source": "initial",
            "dest": "processing",
        },
        {
            "trigger": "approve",
            "source": "processing",
            "dest": "success",
        },
        {
            "trigger": "reject",
            "source": "processing",
            "dest": "failed",
        },
    ]
Esempio n. 3
0
class TransactionRecord(db.Model):
    __table__ = "transaction_record"
    id = db.Column(db.Integer, primary_key=True)
    transaction_id = db.Column(UUIDType(), db.ForeignKey("transaction.id"))
    field = db.Column(db.String(32), doc=_("Field"))
    before = db.Column(db.PickleType, doc=_('Original Value'))
    after = db.Column(db.PickleType, doc=_('New Value'))
    transactions = db.relationship(Transaction, )
Esempio n. 4
0
class OAuth2Token(db.Model, OAuth2TokenMixin):
    __tablename__ = 'oauth2_token'

    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(
        db.Integer, db.ForeignKey('user.id', ondelete='CASCADE'))
    user = db.relationship('User', backref=db.backref("oauth2_token",uselist=False))

    def is_refresh_token_expired(self):
        expires_at = self.issued_at + self.expires_in * 2
        return expires_at < time.time()
Esempio n. 5
0
class Client(db.Model, OAuth2ClientMixin):
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(
        db.Integer, db.ForeignKey('user.id', ondelete='CASCADE')
    )
    user = db.relationship('User')
Esempio n. 6
0
class Child(TransactionEnabled, db.Model):
    __tablename__ = 'child'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(length=255))
    parent_id = db.Column(db.Integer, db.ForeignKey('parent.id'))
    parent = db.relationship("Parent")