Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

実装作戦会議 #6

Open
wass88 opened this issue Sep 8, 2019 · 9 comments
Open

実装作戦会議 #6

wass88 opened this issue Sep 8, 2019 · 9 comments

Comments

@wass88
Copy link
Collaborator

wass88 commented Sep 8, 2019

@wass88
Copy link
Collaborator Author

wass88 commented Sep 8, 2019

API

@app.route("/initialize", methods=["POST"])
@app.route("/new_items.json", methods=["GET"])@ def get_new_items():
@app.route("/new_items/<root_category_id>.json", methods=["GET"])@ def get_new_category_items(root_category_id=None):
@app.route("/users/transactions.json", methods=["GET"])@ def get_transactions():
@app.route("/users/<user_id>.json", methods=["GET"])@ def get_user_items(user_id=None):
@app.route("/items/<item_id>.json", methods=["GET"])@ def get_item(item_id=None):
@app.route("/items/edit", methods=["POST"])@ def post_item_edit():
@app.route("/buy", methods=["POST"])@ def post_buy():
@app.route("/sell", methods=["POST"])@ def post_sell():
@app.route("/ship", methods=["POST"])@ def post_ship():
@app.route("/ship_done", methods=["POST"])@ def post_ship_done():
@app.route("/complete", methods=["POST"])@ def post_complete():
@app.route("/transactions/<transaction_evidence_id>.png", methods=["GET"])@ def get_qrcode(transaction_evidence_id):
@app.route("/bump", methods=["POST"])@ def post_bump():
@app.route("/settings", methods=["GET"])@ def get_settings():
@app.route("/login", methods=["POST"])@ def post_login():
@app.route("/register", methods=["POST"])@ def post_register():
@app.route("/reports.json", methods=["GET"])@ def get_reports():

@wass88
Copy link
Collaborator Author

wass88 commented Sep 8, 2019

Frontend

@app.route("/")
@app.route("/login")
@app.route("/register")
@app.route("/timeline")
@app.route("/categories/<category_id>/items")
@app.route("/sell")
@app.route("/items/<item_id>")
@app.route("/items/<item_id>/edit")
@app.route("/items/<item_id>/buy")
@app.route("/buy/compelete")
@app.route("/transactions/<transaction_id>")
@app.route("/users/<user_id>")
@app.route("/users/setting")

@wass88
Copy link
Collaborator Author

wass88 commented Sep 8, 2019

External

Payment

POST /cardトークンを得る
shop_id, card_number -> token

POST /token 得たトークンで決済
shop_id, token, api_key, price -> status

Shipment

POST /create 集荷予約を作る State = initial
to_address, to_name, from_address, from_name -> reserve_id, reserve_time

POST /request 集荷リクエスト State = wait_pickup
reserve_id -> png_binary (QRコード!)

GET /accept 発送 State = shipping
reseve_id -> status

GET /status
reserve_id -> reserve_time, status(initial, wait_pickup, shipping, done)

@utgwkk
Copy link
Collaborator

utgwkk commented Sep 8, 2019

同じ items を2回selectしてるけど最初の1回だけでよさそうに見える
https://github.com/utgwkk/isucon9q/blob/cce28761a84503e32997d06892929705fb68feb1/webapp/python/app.py#L1202-L1233

@wass88
Copy link
Collaborator Author

wass88 commented Sep 8, 2019

売る人

  • GET @/users/2
  • POST /sell name, description, price, category_id, image
    http_json_error(requests.codes['bad_request'], "商品価格は100イスコイン以上、1,000,000イスコイン以下にしてください")

確認

  • GET /settings
  • GET /users/2.json
  • GET /users/transactions.json
  • GET /items/49322.json

配送する

配送確認する

  • GET /settings
  • POST /ship_done
    • GET items/49322.json

買う人

届いた

  • GET /settings
  • POST /complete
  • GET /items/49322.json

@utgwkk
Copy link
Collaborator

utgwkk commented Sep 8, 2019

categories 決め打ちなのでDBに入れる必要なさそう
https://github.com/utgwkk/isucon9q/blob/cce28761a84503e32997d06892929705fb68feb1/webapp/sql/02_categories.sql#L3-L47

@wass88
Copy link
Collaborator Author

wass88 commented Sep 8, 2019

ISUCARI ステータス遷移表

WHO items transaction_evidences shippings
/sell (出品) 出品者 on_sale - -
/buy (購入) 購入者 trading wait_shipping initial
/ship (集荷予約) 出品者 wait_pickup
/ship_done (発送完了) 出品者 wait_done shipping or done
/complete (取引完了) 購入者 sold_out done done

@wass88 wass88 changed the title 作戦会議 実装作戦会議 Sep 8, 2019
@wass88
Copy link
Collaborator Author

wass88 commented Sep 8, 2019

得点要素

  • 完了椅子の価格の合計 - 原点 = スコア

減点失格要素

  • (critical error): 失格
  • レスポンスやステータスミス: 1回500減点, 10回で失格
  • タイムアウト (タイムアウトしました, 一時的なエラー): 200回まで0.100回毎に5000減点 失格なし

ベンチ

初期化処理の実行 POST /initialize(20秒以内)
アプリケーション互換性チェックの走行(適宜: 数秒〜数十秒)
負荷走行(60秒)
負荷走行後の確認(適宜: 数秒〜数十秒)

campaignの値を0から4にすることで増えるらしい

@wass88
Copy link
Collaborator Author

wass88 commented Sep 8, 2019

DB Scheme #10 #10

users

items

  • id: PRMKEY
  • seller_id:
  • buyer_id:
  • status: on_sale, trading, sold_out, stop, cancel
  • name
  • price
  • description
  • category_id: INDEX
  • created_at
  • updated_at

transaction_evidences

  • id: PRMKEY
  • seller_id
  • buyer_id
  • status: wait_shipping, wait_done, done
  • item_id
  • item_name
  • item_price
  • item_description
  • item_category_id
  • item_root_category_id
  • created_at
  • update_at

shippings

  • transaction_evidence_id: PRMKEY
  • status: initial, wait_pickup, shipping, done
  • item_name:
  • item_id:
  • reserve_id:
  • reserve_time:
  • to_address
  • to_name
  • from_address
  • from_name
  • img_binary
  • created_at
  • updated_at

@wass88 wass88 mentioned this issue Sep 8, 2019
3 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants