1
0
Fork 0
mirror of https://github.com/dancojocaru2000/foxbank.git synced 2025-02-22 23:39:36 +02:00

Fixed /accounts/... response

This commit is contained in:
Kenneth Bruen 2021-12-29 20:36:05 +02:00
parent 17d1cb2400
commit 02cf164620
Signed by: kbruen
GPG key ID: C1980A470C3EE5B1

View file

@ -35,10 +35,15 @@ def get_valid_account_types():
return returns.success(account_types=ACCOUNT_TYPES) return returns.success(account_types=ACCOUNT_TYPES)
class AccountResponseSchema(returns.SuccessSchema):
account = fields.Nested(Account.Schema)
@bp.get('/<int:account_id>') @bp.get('/<int:account_id>')
@ensure_logged_in @ensure_logged_in
@bp.response(401, returns.ErrorSchema, description='Login failure') @bp.response(401, returns.ErrorSchema, description='Login failure')
@bp.doc(security=[{'Token': []}]) @bp.doc(security=[{'Token': []}])
@bp.response(200, AccountResponseSchema)
def get_account_id(account_id: int): def get_account_id(account_id: int):
"""Get account by id""" """Get account by id"""
account = db_utils.get_account(account_id=account_id) account = db_utils.get_account(account_id=account_id)
@ -54,6 +59,7 @@ def get_account_id(account_id: int):
@ensure_logged_in @ensure_logged_in
@bp.response(401, returns.ErrorSchema, description='Login failure') @bp.response(401, returns.ErrorSchema, description='Login failure')
@bp.doc(security=[{'Token': []}]) @bp.doc(security=[{'Token': []}])
@bp.response(200, AccountResponseSchema)
def get_account_iban(iban: str): def get_account_iban(iban: str):
"""Get account by IBAN""" """Get account by IBAN"""
account = db_utils.get_account(iban=iban) account = db_utils.get_account(iban=iban)