def get(self, id): expense = Expense.get_by_id(id) if expense: return {'expense': expense.data}, HTTPStatus.OK else: return { 'message': 'Expense with specify ID not found.' }, HTTPStatus.NOT_FOUND
def delete(self, id): expense = Expense.get_by_id(id) if expense: expense.delete() return { 'message': f'Expense with ID {id} has been deleted.' }, HTTPStatus.OK else: return { 'message': 'Expense with specify ID not found.' }, HTTPStatus.NOT_FOUND