Ejemplo n.º 1
0
 def get(self, user_id):
     transactions = [
         transaction_schema.dump(transaction)
         for transaction in TransactionModel.find_all(user_id)
     ]
     if transactions:
         return transactions, 200
     return {'message': 'no transactions available'}, 200
Ejemplo n.º 2
0
    def get(self):
        custom_filter = TransactionList.parser.parse_args()

        if custom_filter.get('deleted'):
            return [transaction.json() for transaction
                    in TransactionModel.filter_by_deleted(str_to_bool(custom_filter.get('deleted')))]
        else:
            return [transaction.json() for transaction in TransactionModel.find_all()]
Ejemplo n.º 3
0
 def get(cls):
     return {
         "transactions":
         transaction_list_schema.dump(TransactionModel.find_all())
     }, 200