docker-compose run bundle install --path vendor/bundle --without production -j4
docker-compose run web bundle exec rake db:create
docker-compose run web bundle exec rake db:migrate
docker-compose run web bundle exec rake db:seeddocker-compose up{
"name": "xxxx",
"password": "xxxx"
}{
"user": {
"name": "xxx",
},
"token": "xxxx-xxxx-xxxx-xxxx"
}ステータス 400 を返却
[
{
"id": 1,
"name": "主食",
"description": null,
"created_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx",
"updated_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx"
},
{
"id": 2,
"name": "副菜",
"description": null,
"created_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx",
"updated_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx"
}
...
](POST) http://localhost:4567/genre
{
"name": "xxxx",
"description": "xxxx",
"userToken": 'xxxx-xxxx-xxxx-xxxx'
}ステータス 201 を返却
ステータス 500 を返却
またuserTokenが期限切れ又は入っていない場合 403
{
"name": "xxxx",
"description": "xxxx",
"userToken": 'xxxx-xxxx-xxxx-xxxx'
}{
"name": "xxxx",
"description": "xxxx"
}ステータス 500 を返却
またuserTokenが期限切れ又は入っていない場合 403
(GET) http://localhost:4567/menus/:id (:idはジャンルのユニークIDを指定する) カテゴリ1(今回は主食)に属するメニュー一覧を取得する
[
{
"id": 1, //メニューのユニークID
"category_id": 1, //属しているカテゴリのID
"genre_id": 1, //属しているカテゴリのID
"name": "鯖の味噌煮",//メニュー名
"description": null, //メニューの説明
"created_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx", //メニューが作られた日
"updated_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx" //メニューの最終更新日
},
{
"id": 2,
"category_id": 2,
"genre_id": 1,
"name": "回鍋肉",
"description": null,
"created_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx",
"updated_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx"
}
...
](GET) http://localhost:4567/menu/:id (:idはmenuのIDを指定する)
{
"id": 18, // メニューのユニークID
"category_id": 1, //属しているカテゴリのID
"genre_id": 1, //属しているジャンルのID
"name": "ペペロンチーノ", //メニュー名
"description": null, //説明
"created_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx", //このメニューが作られた日
"updated_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx", //このメニューの最終更新日
"ingredients": [
{
"id": 31, //材料のユニークID
"menu_id": 18, //属しているメニューID
"name": "パスタ", //材料の名前
"amount": 100, //材料の量
"unit": "g", //材料の単位
"cost": 40, //材料の値段
"description": "8分茹でる", //材料の説明
"created_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx", //この材料の作られた日
"updated_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx" //この材料の最終更新日
},
{
"id": 32,
"menu_id": 18,
"name": "オリーブオイル",
"amount": 30,
"unit": "ml",
"cost": 7,
"description": "",
"created_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx",
"updated_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx"
},
{
"id": 33,
"menu_id": 18,
"name": "にんにく",
"amount": 8,
"unit": "枚",
"cost": 10,
"description": "オリーブオイルで焦がす",
"created_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx",
"updated_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx"
}
],
steps: [
{
"id": 1,
"menu_id": 18,
"description": "にんにくを切る",
"created_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx",
"updated_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx"
},
{
"id": 2,
"menu_id": 18,
"description": "フライパンにオリーブオイルを敷く",
"created_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx",
"updated_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx"
}
]
}(POST) http://localhost:4567/menu
{
"name": "", //メニュー名
"genre_id": "", //属したいジャンルのID
"ingredients": [ //材料
{
"name": "", //材料名
"amount": 0, //量
"unit": "", //単位
"cost": 0, //値段
"description": "" //説明
},
{
"name": "",
"amount": 0,
"unit": "",
"cost": 0,
"description": ""
}
],
steps: [ //工程
{"description": ""}, //工程の説明
{"description": ""},
{"description": ""},
{"description": ""},
]
"userToken": 'xxxx-xxxx-xxxx-xxxx'
}{
"id": 20,
"category_id": 1,
"genre_id": 1,
"name": "ハンバーグ",
"description": null,
"created_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx",
"updated_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx"
}ステータス 500 を返却
またuserTokenが期限切れ又は入っていない場合 403
(POST) http://localhost:4567/menu/:id
/:idの部分は更新したいメニューのユニークID
最低限URLが合っていれば更新したい項目のkeyとvalueを入れてくれれば更新できます。
(userTokenは必須無いと 403 返します)
{
"name": "ハンバーグ",
"description": null,
"ingredients": [ //最低限材料のユニークIDと更新したい項目今回はnameだけ更新したい場合
{"id": 37, "name": "ひき肉"}
],
"removeIngredientItemList": [ //削除したい材料のユニークIDを入れる
{"id": 38}
],
"removeStepItemList": [ //削除したい工程のユニークIDを入れる
{"id": 39}
]
"userToken": 'xxxx-xxxx-xxxx-xxxx'
}{
"id": 20,
"category_id": 1,
"genre_id": 1,
"name": "ハンバーグ",
"description": null,
"created_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx",
"updated_at": "xxxx-xx-xxTxx:xx:xx.xx+xx:xx"
}ステータス 500 を返却
またuserTokenが期限切れ又は入っていない場合 403