์ฟ ํฐ(Coupon)
-์ฟ ํฐ์ ๋ํด ์์ฑ/์ญ์ /์กฐํ/๋ฐ๊ธ/์ฌ์ฉ ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค.-
-
์ฟ ํฐ ์์ฑ
-๊ด๋ฆฌ์๊ฐ ์ฟ ํฐ์ ์์ฑํฉ๋๋ค.-
์์ฒญ
-POST /admins/coupons HTTP/1.1
-Content-Type: application/json;charset=UTF-8
-Content-Length: 186
-Host: localhost:8080
-
-{
- "name" : "couponName",
- "description" : "coupon description",
- "type" : "ํฉ๊ธ",
- "point" : 10,
- "maxCount" : 10,
- "startAt" : "2023-02-01",
- "openAt" : "2023-01-01"
-}
-์๋ต
-HTTP/1.1 201 Created
-Access-Control-Allow-Origin: http://localhost:8080
-Access-Control-Allow-Methods: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH
-Access-Control-Allow-Headers: Origin, Accept, Access-Control-Request-Method, Access-Control-Request-Headers, X-Requested-With,Content-Type, Referer
-Access-Control-Allow-Credentials: true
-Access-Control-Max-Age: 3600
--
์ฟ ํฐ ์ญ์
-๊ด๋ฆฌ์๊ฐ ์ฟ ํฐ ID์ ์ผ์นํ๋ ์ฟ ํฐ์ ์ญ์ ํฉ๋๋ค.-
์์ฒญ
-DELETE /admins/coupons/36 HTTP/1.1
-Host: localhost:8080
-์๋ต
-HTTP/1.1 200 OK
-Access-Control-Allow-Origin: http://localhost:8080
-Access-Control-Allow-Methods: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH
-Access-Control-Allow-Headers: Origin, Accept, Access-Control-Request-Method, Access-Control-Request-Headers, X-Requested-With,Content-Type, Referer
-Access-Control-Allow-Credentials: true
-Access-Control-Max-Age: 3600
--
ํน์ ์ฟ ํฐ ์กฐํ
-๊ด๋ฆฌ์ ํน์ ์ฌ์ฉ์๊ฐ ํน์ ID์ ์ผ์นํ๋ ์ฟ ํฐ์ ์กฐํํฉ๋๋ค.-
์์ฒญ
-GET /coupons/24 HTTP/1.1
-Host: localhost:8080
-์๋ต
-HTTP/1.1 200 OK
-Access-Control-Allow-Origin: http://localhost:8080
-Access-Control-Allow-Methods: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH
-Access-Control-Allow-Headers: Origin, Accept, Access-Control-Request-Method, Access-Control-Request-Headers, X-Requested-With,Content-Type, Referer
-Access-Control-Allow-Credentials: true
-Access-Control-Max-Age: 3600
-Content-Type: application/json
-Content-Length: 202
-
-{
- "id" : 24,
- "adminId" : 1,
- "name" : "couponName",
- "description" : "",
- "point" : 10,
- "maxCount" : 100,
- "type" : "MORNING",
- "startAt" : "2023-02-01",
- "openAt" : "2023-01-01"
-}
--
์ํ์ ๋ฐ๋ฅธ ์ฟ ํฐ๋ค์ ์กฐํ
-๊ด๋ฆฌ์ ํน์ ์ฌ์ฉ์๊ฐ ๋ ์ง ์ํ์ ๋ฐ๋ผ ์ฟ ํฐ๋ค์ ์กฐํํฉ๋๋ค.-
์์ฒญ
-POST /coupons/search HTTP/1.1
-Content-Type: application/json;charset=UTF-8
-Content-Length: 44
-Host: localhost:8080
-
-{
- "opened" : false,
- "ended" : false
-}
-์๋ต
-HTTP/1.1 200 OK
-Access-Control-Allow-Origin: http://localhost:8080
-Access-Control-Allow-Methods: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH
-Access-Control-Allow-Headers: Origin, Accept, Access-Control-Request-Method, Access-Control-Request-Headers, X-Requested-With,Content-Type, Referer
-Access-Control-Allow-Credentials: true
-Access-Control-Max-Age: 3600
-Content-Type: application/json
-Content-Length: 203
-
-[ {
- "id" : 25,
- "adminId" : 1,
- "name" : "coupon1",
- "description" : "",
- "point" : 10,
- "maxCount" : 100,
- "type" : "MORNING",
- "startAt" : "2023-03-01",
- "openAt" : "2023-01-01"
-} ]
--
ํน์ ์ฟ ํฐ์ ๋ํด ๋ฐ๊ธ
-์ฌ์ฉ์๊ฐ ๋ฐ๊ธ ๊ฐ๋ฅํ ์ฟ ํฐ์ ์ ์ฐฉ์์ผ๋ก ๋ฐ๊ธ ๋ฐ์ต๋๋ค.-
์์ฒญ
-POST /coupons HTTP/1.1
-Content-Type: application/x-www-form-urlencoded
-Host: localhost:8080
-Content-Length: 21
-
-couponName=couponName
-์๋ต
-HTTP/1.1 409 Conflict
-Access-Control-Allow-Origin: http://localhost:8080
-Access-Control-Allow-Methods: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH
-Access-Control-Allow-Headers: Origin, Accept, Access-Control-Request-Method, Access-Control-Request-Headers, X-Requested-With,Content-Type, Referer
-Access-Control-Allow-Credentials: true
-Access-Control-Max-Age: 3600
-Content-Type: application/json
-Content-Length: 65
-
-{
- "message" : "์ด๋ฏธ ์ฟ ํฐ ๋ฐ๊ธ์ ์ฑ๊ณตํ์ต๋๋ค!"
-}
--
ํน์ ์ฌ์ฉ์์ ์ฟ ํฐ ๋ณด๊ดํจ์ ์กฐํ
-์ฌ์ฉ์๊ฐ ์์ ์ ๋ณด๊ดํจ์ ์๋ ์ฟ ํฐ๋ค์ ์กฐํํฉ๋๋ค.-
์์ฒญ
-GET /my-coupons HTTP/1.1
-Host: localhost:8080
-์๋ต
-HTTP/1.1 200 OK
-Access-Control-Allow-Origin: http://localhost:8080
-Access-Control-Allow-Methods: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH
-Access-Control-Allow-Headers: Origin, Accept, Access-Control-Request-Method, Access-Control-Request-Headers, X-Requested-With,Content-Type, Referer
-Access-Control-Allow-Credentials: true
-Access-Control-Max-Age: 3600
-Content-Type: application/json
-Content-Length: 3
-
-[ ]
--
์ฟ ํฐ์ ์ฌ์ฉ
-์ฌ์ฉ์๊ฐ ์์ ์ ๋ณด๊ดํจ์ ์๋ ์ฟ ํฐ๋ค์ ์ฌ์ฉํฉ๋๋ค.-
์์ฒญ
-POST /my-coupons/8 HTTP/1.1
-Host: localhost:8080
-Content-Type: application/x-www-form-urlencoded
-์๋ต
-HTTP/1.1 200 OK
-Access-Control-Allow-Origin: http://localhost:8080
-Access-Control-Allow-Methods: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH
-Access-Control-Allow-Headers: Origin, Accept, Access-Control-Request-Method, Access-Control-Request-Headers, X-Requested-With,Content-Type, Referer
-Access-Control-Allow-Credentials: true
-Access-Control-Max-Age: 3600
--