def postTransaction(): current_app.logger.debug(request.json) item_id = request.json['item_id'] seller_id = request.json['seller_id'] buyer_id = request.json['buyer_id'] set_count = request.json['set_count'] transaction = ItemTransaction(item_id=item_id, seller_id=seller_id, buyer_id=buyer_id, set_count=set_count) transaction.postRecord() # app.logger.debug(json_dict) # app.logger.debug(request.files) return jsonify({'state': True, 'id': transaction.id})
def getBySellerIdStateSold(): seller_id = request.args.get('id') records = ItemTransaction.getRecordsBySellerIdStateSold(seller_id) current_app.logger.debug(records) item_transaction_schema = ItemTransactionSchema(many=True) return jsonify({ 'state': True, 'entries': item_transaction_schema.dump(records) })
def getById(): transaction_id = request.args.get('id') record = ItemTransaction.getRecordById(transaction_id) current_app.logger.debug(record) item_transaction_schema = ItemTransactionSchema() return jsonify({ 'state': True, 'entries': item_transaction_schema.dump(record) })
def getSalesDetailBySellerId(): seller_id = request.args.get('id') record = ItemTransaction.getSalesDetailBySellerId(seller_id=seller_id, item_model=Item) current_app.logger.debug(record) item_transaction_schema = ItemTransactionSchema() return jsonify({ 'state': True, 'entries': 0 if record is None else int(record[0]) })
def patchStateShipment(): transaction_id = request.json['id'] record = ItemTransaction.getRecordById(transaction_id) record.state = 1 db.session.commit() return jsonify({'state': True})