Total Complexity | 3 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from .model import * |
||
5 | class BtcPendingDeposit(Base): |
||
6 | __tablename__ = 'btcpending' |
||
7 | |||
8 | id = Column(Integer, primary_key=True, nullable=False) |
||
9 | user_id = Column(Integer, ForeignKey("users.id"), nullable=False) # user the address "belongs" to |
||
10 | auth_key = Column(String(64), nullable=False) # authentication string needed in the callback, otherwise it probably didn't come from coinbase |
||
11 | address = Column(String(64), nullable=False) # bitcoin address |
||
12 | |||
13 | def __init__(self, user, auth_key, address): |
||
14 | self.user_id = user.id |
||
15 | self.auth_key = auth_key |
||
16 | self.address = address |
||
17 | |||
18 | @classmethod |
||
19 | def from_id(cls, id): |
||
20 | e = DBSession.query(cls).filter(cls.id == id).one() |
||
21 | return e |
||
22 | |||
23 | @classmethod |
||
24 | def from_auth_key(cls, auth_key): |
||
25 | e = DBSession.query(cls).filter(cls.auth_key == auth_key).one() |
||
26 | return e |
||
27 |