qin-team-recipe / 03-recipe-app-backend

0 stars 0 forks source link

シェフ登録・更新処理 #38

Closed kanedaq closed 1 year ago

kanedaq commented 1 year ago

シェフ関連

(UPDATE 2023-08-08)IDを指定してシェフを取得するAPI

GET /api/chefs/:id

レスポンス例:

{
    "id": "f4da8c3d-64d7-4dcf-858d-f3161304531b",
    "name": "NAME_1",
    "imageUrl": "http://www.yahoo.co.jp",
    "profile": "PROFILE_1",
    "link": [
        {
            "label": "LABEL_1",
            "url": null
        }
    ],
    "createdAt": "2023-07-30T16:04:30.100876+09:00",
    "updatedAt": "2023-08-06T17:16:30.121799+09:00",
    "numRecipe": 7,
    "numFollower": 0
}

(UPDATE 2023-08-08)シェフを新規登録するAPI

POST /api/chefs

リクエストボディー例

{
    "name": "シェフ1",
    "imageUrl": "http://www.yahoo.co.jp",
    "profile": "PROFILE_1",
    "link": [
        {
            "label": "LABEL_1",
            "url": "URL_1"
        }
    ]
}

レスポンス例:

{
    "id": "d309c90c-e318-410e-b342-bed6bc2dc96f",
    "name": "シェフ1",
    "imageUrl": "http://www.yahoo.co.jp",
    "profile": "PROFILE_1",
    "link": [
        {
            "label": "LABEL_1",
            "url": "URL_1"
        }
    ],
    "createdAt": "2023-08-09T05:46:08.569996+09:00",
    "updatedAt": "2023-08-09T05:46:08.569996+09:00",
    "numRecipe": 0,
    "numFollower": 0
}

(UPDATE 2023-08-08)IDを指定してシェフを更新するAPI

PUT /api/chefs/:id

リクエストボディー例

{
    "name": "Mシェフ",
    "imageUrl": "http://www.yahoo.co.jp",
    "profile": "平成14年事例Ⅱで出題されたMシェフ。三國清三がモデルではないか?と噂になった。",
    "link": [
        {
            "label": "LABEL_1",
            "url": "URL_1"
        },
        {
            "label": "LABEL_2",
            "url": "URL_2"
        }
    ]
}

レスポンス例:

{
    "id": "d309c90c-e318-410e-b342-bed6bc2dc96f",
    "name": "Mシェフ",
    "imageUrl": "http://www.yahoo.co.jp",
    "profile": "平成14年事例Ⅱで出題されたMシェフ。三國清三がモデルではないか?と噂になった。",
    "link": [
        {
            "label": "LABEL_1",
            "url": "URL_1"
        },
        {
            "label": "LABEL_2",
            "url": "URL_2"
        }
    ],
    "createdAt": "2023-08-09T05:46:08.569996+09:00",
    "updatedAt": "2023-08-09T05:46:46.296479+09:00",
    "numRecipe": 0,
    "numFollower": 0
}

ユーザー関連

(UPDATE 2023-08-08)ユーザーを取得するAPI

GET /api/user/users

レスポンス例:

{
    "id": "1c6fc87e-430b-4e71-af55-103fe3a16bee",
    "email": "kaneda@gmail.com",
    "name": "NAME_1",
    "imageUrl": "http://www.yahoo.co.jp",
    "profile": "PROFILE_1",
    "link": [
        {
            "label": "LABEL_1",
            "url": "http://www.yahoo.co.jp"
        },
        {
            "label": "LABEL_2",
            "url": "http://www.yahoo.co.jp"
        }
    ],
    "createdAt": "2023-08-08T18:48:40.89562+09:00",
    "updatedAt": "2023-08-08T19:56:55.402664+09:00",
    "numRecipe": 0
}

(UPDATE 2023-08-08)ユーザーを更新するAPI

PUT /api/user/users

リクエストボディー例

{
    "name": "NAME_1",
    "imageUrl": "http://www.yahoo.co.jp",
    "profile": "PROFILE_1",
    "link": [
        {
            "label": "LABEL_1",
            "url": "http://www.yahoo.co.jp"
        },
        {
            "label": "LABEL_2",
            "url": "http://www.yahoo.co.jp"
        }
    ]
}

レスポンス例:

{
    "id": "1c6fc87e-430b-4e71-af55-103fe3a16bee",
    "email": "kaneda@gmail.com",
    "name": "NAME_1",
    "imageUrl": "http://www.yahoo.co.jp",
    "profile": "PROFILE_1",
    "link": [
        {
            "label": "LABEL_1",
            "url": "http://www.yahoo.co.jp"
        },
        {
            "label": "LABEL_2",
            "url": "http://www.yahoo.co.jp"
        }
    ],
    "createdAt": "2023-08-08T18:48:40.89562+09:00",
    "updatedAt": "2023-08-08T19:56:55.402664+09:00",
    "numRecipe": 0
}

レシピ関連

(UPDATE 2023-08-08)IDを指定してレシピを取得するAPI

GET /api/recipes/:id

レスポンス例:

{
    "id": "fcd040c9-8ea9-4833-a42d-95e57c47a745",
    "chefId": "f4da8c3d-64d7-4dcf-858d-f3161304531b",
    "usrId": null,
    "name": "名前1",
    "servings": 4,
    "ingredient": [
        {
            "id": "157e8f3d-033f-47b4-b74c-332d2caf2437",
            "name": "キャベツ",
            "supplement": "補足1"
        },
        {
            "id": "66605cad-fa1e-4405-97a5-e669018ead6e",
            "name": "トマト",
            "supplement": "補足2"
        }
    ],
    "method": [
        {
            "html": "<p>作り方1</p>",
            "supplement": {
                "key": "value"
            }
        },
        {
            "html": "<p>作り方2</p>",
            "supplement": [
                {
                    "key1": "value1"
                },
                {
                    "key2": "value2",
                    "key3": "value3"
                }
            ]
        }
    ],
    "imageUrl": "IMAGE_URL_1",
    "introduction": "INTRODUCTION_1",
    "link": [
        "https://www.yahoo.co.jp",
        "https://www.amazon.co.jp"
    ],
    "accessLevel": 2,
    "createdAt": "2023-08-06T06:14:53.749359+09:00",
    "updatedAt": "2023-08-06T12:45:56.980533+09:00",
    "numFav": 0
}

(UPDATE 2023-08-08)有名シェフのレシピを新規登録するAPI

POST /api/recipes/chef

リクエストボディー例

{
    "chefId": "f4da8c3d-64d7-4dcf-858d-f3161304531b",
    "name": "マカロニグラタン",
    "servings": 4,
    "ingredient": [
        {
            "name": "マカロニ",
            "supplement": "パスタ"
        },
        {
            "name": "グラタン",
            "supplement": "チーズ"
        }
    ],
    "method": [
        {
            "html": "<p>煮る</p>",
            "supplement": {
                "key": "value"
            }
        },
        {
            "html": "<p>焼く</p>",
            "supplement": [
                {
                    "key1": "value1"
                },
                {
                    "key2": "value2",
                    "key3": "value3"
                }
            ]
        }
    ],
    "imageUrl": "IMAGE_URL_1",
    "introduction": "INTRODUCTION_1",
    "link": [
        "https://www.yahoo.co.jp",
        "https://www.amazon.co.jp"
    ],
    "accessLevel": 2
}

レスポンス例:

{
    "id": "06591f60-66f6-4697-b905-5d0a671a68af",
    "chefId": "f4da8c3d-64d7-4dcf-858d-f3161304531b",
    "usrId": null,
    "name": "マカロニグラタン",
    "servings": 4,
    "ingredient": [
        {
            "id": "3c5ca4ea-a580-461e-ac20-0345a7e1fa34",
            "name": "マカロニ",
            "supplement": "パスタ"
        },
        {
            "id": "2e194100-69ad-4fe7-bcc3-adfdb90907f2",
            "name": "グラタン",
            "supplement": "チーズ"
        }
    ],
    "method": [
        {
            "html": "<p>煮る</p>",
            "supplement": {
                "key": "value"
            }
        },
        {
            "html": "<p>焼く</p>",
            "supplement": [
                {
                    "key1": "value1"
                },
                {
                    "key2": "value2",
                    "key3": "value3"
                }
            ]
        }
    ],
    "imageUrl": "IMAGE_URL_1",
    "introduction": "INTRODUCTION_1",
    "link": [
        "https://www.yahoo.co.jp",
        "https://www.amazon.co.jp"
    ],
    "accessLevel": 2,
    "createdAt": "2023-08-06T17:16:30.121799+09:00",
    "updatedAt": "2023-08-06T17:16:30.121799+09:00",
    "numFav": 0
}

(UPDATE 2023-08-08)ユーザー(一般シェフ)のマイレシピを新規登録するAPI

POST /api/user/recipes/user

リクエストボディー例

{
    "name": "オムライス",
    "servings": 6,
    "ingredient": [
        {
            "name": "卵",
            "supplement": "鶏卵"
        },
        {
            "name": "トマト",
            "supplement": "ケチャップ"
        }
    ],
    "method": [
        {
            "html": "<p>卵を焼く</p>",
            "supplement": {
                "key": "value"
            }
        },
        {
            "html": "<p>ケチャップをかける</p>",
            "supplement": [
                {
                    "key1": "value1"
                },
                {
                    "key2": "value2",
                    "key3": "value3"
                }
            ]
        }
    ],
    "imageUrl": "IMAGE_URL_1",
    "introduction": "INTRODUCTION_1",
    "link": [
        "https://www.yahoo.co.jp",
        "https://www.amazon.co.jp"
    ],
    "accessLevel": 2
}

レスポンス例:

{
    "id": "41eb8f23-7b27-4094-b2fc-b3e576e36b54",
    "chefId": null,
    "usrId": "2c92aad1-a117-451b-88d1-70935c360fdf",
    "name": "オムライス",
    "servings": 6,
    "ingredient": [
        {
            "id": "d511d238-bbb9-4eb0-ba0e-811e3ec7b591",
            "name": "卵",
            "supplement": "鶏卵"
        },
        {
            "id": "d0a35ca6-6478-4339-aa8f-76a6628ee796",
            "name": "トマト",
            "supplement": "ケチャップ"
        }
    ],
    "method": [
        {
            "html": "<p>卵を焼く</p>",
            "supplement": {
                "key": "value"
            }
        },
        {
            "html": "<p>ケチャップをかける</p>",
            "supplement": [
                {
                    "key1": "value1"
                },
                {
                    "key2": "value2",
                    "key3": "value3"
                }
            ]
        }
    ],
    "imageUrl": "IMAGE_URL_1",
    "introduction": "INTRODUCTION_1",
    "link": [
        "https://www.yahoo.co.jp",
        "https://www.amazon.co.jp"
    ],
    "accessLevel": 2,
    "createdAt": "2023-08-06T17:23:10.558309+09:00",
    "updatedAt": "2023-08-06T17:23:10.558309+09:00",
    "numFav": 0
}

(UPDATE 2023-08-08)IDを指定してレシピを更新するAPI

PUT /api/recipes/:id

リクエストボディー例

{
    "name": "名前を変えてみる",
    "servings": 4,
    "ingredient": [
        {
            "id": "157e8f3d-033f-47b4-b74c-332d2caf2437",
            "name": "修正1",
            "supplement": "修正補足1"
        },
        {
            "id": null,
            "name": "追加2",
            "supplement": "追加補足2"
        }
    ],
    "method": [
        {
            "html": "<p>作り方1</p>",
            "supplement": {
                "key": "value"
            }
        },
        {
            "html": "<p>作り方2</p>",
            "supplement": [
                {
                    "key1": "value1"
                },
                {
                    "key2": "value2",
                    "key3": "value3"
                }
            ]
        }
    ],
    "imageUrl": "IMAGE_URL_1",
    "introduction": "INTRODUCTION_1",
    "link": [
        "https://www.yahoo.co.jp",
        "https://www.amazon.co.jp"
    ],
    "accessLevel": 2
}

レスポンス例:

{
    "id": "fcd040c9-8ea9-4833-a42d-95e57c47a745",
    "chefId": "f4da8c3d-64d7-4dcf-858d-f3161304531b",
    "usrId": null,
    "name": "名前を変えてみる",
    "servings": 4,
    "ingredient": [
        {
            "id": "157e8f3d-033f-47b4-b74c-332d2caf2437",
            "name": "修正1",
            "supplement": "修正補足1"
        },
        {
            "id": "8b830fd4-d3f8-48ea-8956-dd4f28e40984",
            "name": "追加2",
            "supplement": "追加補足2"
        }
    ],
    "method": [
        {
            "html": "<p>作り方1</p>",
            "supplement": {
                "key": "value"
            }
        },
        {
            "html": "<p>作り方2</p>",
            "supplement": [
                {
                    "key1": "value1"
                },
                {
                    "key2": "value2",
                    "key3": "value3"
                }
            ]
        }
    ],
    "imageUrl": "IMAGE_URL_1",
    "introduction": "INTRODUCTION_1",
    "link": [
        "https://www.yahoo.co.jp",
        "https://www.amazon.co.jp"
    ],
    "accessLevel": 2,
    "createdAt": "2023-08-06T06:14:53.749359+09:00",
    "updatedAt": "2023-08-06T17:22:06.900841+09:00",
    "numFav": 0
}