feat: add new column and delete old
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
from fastapi import APIRouter, Request, Depends
|
||||
from fastapi.responses import ORJSONResponse
|
||||
from starlette import status
|
||||
from src.application.commands import SetPhoneCommand, SetCryptoWalletStartCommand, SetCryptoWalletCompleteCommand, UpdateBankDetailsStartCommand, UpdateBankDetailsCompleteCommand, ChangePasswordStartCommand, ChangePasswordCompleteCommand, ChangeEmailStartCommand, ChangeEmailConfirmOldCommand, ChangeEmailCompleteCommand
|
||||
from src.application.commands import SetPhoneCommand, SetEncryptedMnemonicStartCommand, SetEncryptedMnemonicCompleteCommand, UpdateBankDetailsStartCommand, UpdateBankDetailsCompleteCommand, ChangePasswordStartCommand, ChangePasswordCompleteCommand, ChangeEmailStartCommand, ChangeEmailConfirmOldCommand, ChangeEmailCompleteCommand
|
||||
from src.application.domain.dto import AuthContext
|
||||
from src.presentation.decorators import require_access_token
|
||||
from src.presentation.dependencies import (
|
||||
get_set_phone_command,
|
||||
get_set_crypto_wallet_start_command,
|
||||
get_set_crypto_wallet_complete_command,
|
||||
get_set_encrypted_mnemonic_start_command,
|
||||
get_set_encrypted_mnemonic_complete_command,
|
||||
get_update_bank_details_start_command,
|
||||
get_update_bank_details_complete_command,
|
||||
get_change_password_start_command,
|
||||
@@ -16,7 +16,7 @@ from src.presentation.dependencies import (
|
||||
get_change_email_confirm_old_command,
|
||||
get_change_email_complete_command,
|
||||
)
|
||||
from src.presentation.schemas import SetPhoneRequest, CryptoWalletConfirmRequest, BankConfirmRequest, ChangePasswordConfirmRequest, ChangeEmailConfirmOldRequest, ChangeEmailCompleteRequest
|
||||
from src.presentation.schemas import SetPhoneRequest, EncryptedMnemonicConfirmRequest, BankConfirmRequest, ChangePasswordConfirmRequest, ChangeEmailConfirmOldRequest, ChangeEmailCompleteRequest
|
||||
|
||||
|
||||
account_settings_router = APIRouter(prefix='/settings')
|
||||
@@ -33,29 +33,29 @@ async def set_phone(
|
||||
return ORJSONResponse(status_code=status.HTTP_200_OK, content={'phone': user.phone})
|
||||
|
||||
|
||||
@account_settings_router.post(path='/crypto-wallet/start', response_class=ORJSONResponse, status_code=status.HTTP_200_OK)
|
||||
async def crypto_wallet_start(
|
||||
@account_settings_router.post(path='/encrypted-mnemonic/start', response_class=ORJSONResponse, status_code=status.HTTP_200_OK)
|
||||
async def encrypted_mnemonic_start(
|
||||
request: Request,
|
||||
auth: AuthContext = Depends(require_access_token),
|
||||
command: SetCryptoWalletStartCommand = Depends(get_set_crypto_wallet_start_command),
|
||||
command: SetEncryptedMnemonicStartCommand = Depends(get_set_encrypted_mnemonic_start_command),
|
||||
):
|
||||
result = await command(user_id=auth.user_id)
|
||||
return {'success': result}
|
||||
|
||||
|
||||
@account_settings_router.post(path='/crypto-wallet/complete', response_class=ORJSONResponse, status_code=status.HTTP_200_OK)
|
||||
async def crypto_wallet_complete(
|
||||
@account_settings_router.post(path='/encrypted-mnemonic/complete', response_class=ORJSONResponse, status_code=status.HTTP_200_OK)
|
||||
async def encrypted_mnemonic_complete(
|
||||
request: Request,
|
||||
body: CryptoWalletConfirmRequest,
|
||||
body: EncryptedMnemonicConfirmRequest,
|
||||
auth: AuthContext = Depends(require_access_token),
|
||||
command: SetCryptoWalletCompleteCommand = Depends(get_set_crypto_wallet_complete_command),
|
||||
command: SetEncryptedMnemonicCompleteCommand = Depends(get_set_encrypted_mnemonic_complete_command),
|
||||
):
|
||||
user = await command(
|
||||
user_id=auth.user_id,
|
||||
code=body.code,
|
||||
wallet_address=body.wallet_address,
|
||||
encrypted_mnemonic=body.encrypted_mnemonic,
|
||||
)
|
||||
return {'crypto_wallet': user.crypto_wallet}
|
||||
return {'encrypted_mnemonic': user.encrypted_mnemonic}
|
||||
|
||||
|
||||
@account_settings_router.post(path='/email/start', response_class=ORJSONResponse, status_code=status.HTTP_200_OK)
|
||||
|
||||
Reference in New Issue
Block a user