ITEM API Doc - Kim-Gyuri/bookstore GitHub Wiki

  • μƒν’ˆ λ“±λ‘ν•˜κΈ°
    • 등둝 μ„±κ³΅ν–ˆμ„ λ•Œ
    • 등둝 μ‹€νŒ¨ν–ˆμ„ λ•Œ (μƒν’ˆ 이름, μƒν’ˆ μΉ΄ν…Œκ³ λ¦¬κ°€ λ™μΌν•œ μƒν’ˆμ„ 등둝할 λ•Œ)
  • λ“±λ‘ν•œ μƒν’ˆ μ‚­μ œν•˜κΈ°
  • λ“±λ‘ν•œ μƒν’ˆ μˆ˜μ •ν•˜κΈ°
  • λ“±λ‘ν•œ μƒν’ˆ 쑰회 (μƒν’ˆ id둜 쑰회)

βœ… μƒν’ˆ λ“±λ‘ν•˜κΈ°

1. 등둝 μ„±κ³΅ν–ˆμ„ λ•Œ

request-fields

Path Type Description
files File μƒν’ˆ 이미지
loginId String νšŒμ› 아이디
itemName String μƒν’ˆ 이름
quantity Integer μƒν’ˆ μˆ˜λŸ‰
itemType String μƒν’ˆ λ“±κΈ‰
categoryType String μƒν’ˆ μΉ΄ν…Œκ³ λ¦¬

Example request

POST /api/items
Content-Type: multipart/form-data; boundary=--------------------------707314556211009394529486
Host: localhost:8080

request body; {
files: undefined
loginId: "test2"
itemName: "μ΄ˆμ½” μ² ν•™ 이야"
quantity: "10"
itemType: "BEST"
categoryType: "BOOK"
}

Example response

HTTP 201 created
Response Body {"id":62}

2. μƒν’ˆ 등둝 μ‹€νŒ¨ν–ˆμ„ λ•Œ (같은 μƒν’ˆλͺ…, μΉ΄ν…Œκ³ λ¦¬ 경우)

Example response

HTTP 409Conflict
Response Body {이미 λ“±λ‘λœ μƒν’ˆμ΄ μ‘΄μž¬ν•©λ‹ˆλ‹€.}

βœ… λ“±λ‘ν•œ μƒν’ˆ μ‚­μ œν•˜κΈ°

request-fields

Path Type Description
itemId Long μƒν’ˆ 번호

Example request

DELETE api/items/3
Host: localhost:8080

Example response

HTTP 200 ok
RESPONSE BODY { "success": true, "message": "μƒν’ˆμ΄ μ‚­μ œλ˜μ—ˆμŠ΅λ‹ˆλ‹€." }

βœ… λ“±λ‘ν•œ μƒν’ˆ μˆ˜μ •ν•˜κΈ°

request-fields

Path Type Description
itemId Long μƒν’ˆ 번호

Example request

PATCH /api/items/1
Content-Type: multipart/form-data; boundary=--------------------------525302011217717751198166
Host: localhost:8080

Request Body {
multipartFileList: (postman으둜 2개 등둝)
itemName: "μ΄ˆμ½” μ² ν•™ 이야"
quantity: "10"
}

Example response

HTTP 200 ok
{"id":1,"itemName":"μ΄ˆμ½” μ² ν•™ 이야","main_img_path":"https://github.com/Kim-Gyuri/bookstore/assets/57389368/c87b0c45-1ac6-41c3-beb2-82cd80d8c7fd"}

// μ›λž˜ 1개 있던 μƒν’ˆ μ •λ³΄μ˜€λŠ”λ° 2개 λ“±λ‘ν•΄μ„œ 3κ°œκ°€ μ‘°νšŒλœλ‹€.
μΆ”κ°€λ‘œ λ“±λ‘ν•œ 이미지 파일 정보=https://github.com/Kim-Gyuri/bookstore/assets/57389368/62c68662-fd5a-4e15-90a3-7279d99c94cf
μΆ”κ°€λ‘œ λ“±λ‘ν•œ 이미지 파일 정보=C:/newThing/chimm/a8a3040b-7b2e-41e1-b973-228fe0e4bba1..PNG
μΆ”κ°€λ‘œ λ“±λ‘ν•œ 이미지 파일 정보=C:/newThing/chimm/221f95eb-a59d-4695-8684-10db5ca5edb4..PNG

βœ… λ“±λ‘ν•œ μƒν’ˆ 쑰회 (μƒν’ˆ id둜 쑰회)

request-fields

Path Type Description
itemId Long μƒν’ˆ 번호

Example request

GET /api/items/1
Accept: */*
Host: localhost:8080

Example response

HTTP 200 ok
Content-Type: application/json
---- ( response body) -----
{
    "id": 1,
    "name": "1984",
    "price": 10000,
    "quantity": 10,
    "itemType": "HIGHEST",
    "categoryType": "BOOK",
    "status": "SELL",
    "itemImgDtoList": [
        {
            "id": 2,
            "imgName": "1984.jpg",
            "originImgName": "origin.jpg",
            "savePath": "https://github.com/Kim-Gyuri/bookstore/assets/57389368/c87b0c45-1ac6-41c3-beb2-82cd80d8c7fd",
            "yn": null
        }
    ]
}