Philip/ussd db fixes

This commit is contained in:
2021-04-19 08:44:40 +00:00
parent 6b89a2da89
commit 6fef0ecec9
23 changed files with 134 additions and 134 deletions

View File

@@ -1,4 +1,4 @@
"""Create user table
"""Create account table
Revision ID: f289e8510444
Revises:
@@ -17,7 +17,7 @@ depends_on = None
def upgrade():
op.create_table('user',
op.create_table('account',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('blockchain_address', sa.String(), nullable=False),
sa.Column('phone_number', sa.String(), nullable=False),
@@ -29,11 +29,11 @@ def upgrade():
sa.Column('updated', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_user_phone_number'), 'user', ['phone_number'], unique=True)
op.create_index(op.f('ix_user_blockchain_address'), 'user', ['blockchain_address'], unique=True)
op.create_index(op.f('ix_account_phone_number'), 'account', ['phone_number'], unique=True)
op.create_index(op.f('ix_account_blockchain_address'), 'account', ['blockchain_address'], unique=True)
def downgrade():
op.drop_index(op.f('ix_user_blockchain_address'), table_name='user')
op.drop_index(op.f('ix_user_phone_number'), table_name='user')
op.drop_table('user')
op.drop_index(op.f('ix_account_blockchain_address'), table_name='account')
op.drop_index(op.f('ix_account_phone_number'), table_name='account')
op.drop_table('account')

View File

@@ -16,12 +16,12 @@ class AccountStatus(IntEnum):
RESET = 4
class User(SessionBase):
class Account(SessionBase):
"""
This class defines a user record along with functions responsible for hashing the user's corresponding password and
subsequently verifying a password's validity given an input to compare against the persisted hash.
"""
__tablename__ = 'user'
__tablename__ = 'account'
blockchain_address = Column(String)
phone_number = Column(String)
@@ -38,7 +38,7 @@ class User(SessionBase):
self.account_status = AccountStatus.PENDING.value
def __repr__(self):
return f'<User: {self.blockchain_address}>'
return f'<Account: {self.blockchain_address}>'
def create_password(self, password):
"""This method takes a password value and hashes the value before assigning it to the corresponding