update
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from flask import jsonify
|
||||
from marshmallow import ValidationError
|
||||
from app.utils.logger import logger
|
||||
from app.api.services.base_service import BaseService
|
||||
from app.models.transaction import Transaction
|
||||
@@ -57,19 +58,17 @@ class TransactionService(BaseService):
|
||||
})
|
||||
|
||||
response_data = {
|
||||
'status': 'success',
|
||||
'message': 'Transactions retrieved successfully',
|
||||
'data': {
|
||||
'transactions': transactions_data,
|
||||
'count': len(transactions_data)
|
||||
}
|
||||
'transactions': transactions_data,
|
||||
'count': len(transactions_data)
|
||||
}
|
||||
|
||||
return jsonify(response_data), 200
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error retrieving transactions: {str(e)}", exc_info=True)
|
||||
return response_data
|
||||
|
||||
except ValidationError as err:
|
||||
|
||||
logger.error(f"Error retrieving transactions: {str(err)}", exc_info=True)
|
||||
return jsonify({
|
||||
'status': 'error',
|
||||
'message': f'Failed to retrieve transactions: {str(e)}'
|
||||
'message': f'Failed to retrieve transactions: {str(err)}'
|
||||
}), 500
|
||||
|
||||
Reference in New Issue
Block a user