Skip to content

Latest commit

ย 

History

History
711 lines (584 loc) ยท 11 KB

File metadata and controls

711 lines (584 loc) ยท 11 KB

๐Ÿ“š Planu Backend API ๋ฌธ์„œ

Planu ๋ฐฑ์—”๋“œ API์˜ ์ „์ฒด ์—”๋“œํฌ์ธํŠธ ๋ช…์„ธ์„œ์ž…๋‹ˆ๋‹ค.

๐Ÿ“‘ ๋ชฉ์ฐจ


๐Ÿ” ์ธ์ฆ API

๊ณต๊ฐœ API (์ธ์ฆ ๋ถˆํ•„์š”)

1. ์ด๋ฉ”์ผ ์ค‘๋ณต ํ™•์ธ

POST /auth/checkDuplicateEmail
Content-Type: application/json

{
  "email": "user@example.com"
}

์‘๋‹ต: "true" (์‚ฌ์šฉ ๊ฐ€๋Šฅ) ๋˜๋Š” "false" (์ค‘๋ณต)

2. ์ด๋ฉ”์ผ ์กด์žฌ ํ™•์ธ

POST /auth/checkExistEmail
Content-Type: application/json

{
  "email": "user@example.com"
}

์‘๋‹ต: User ๊ฐ์ฒด ๋˜๋Š” 404

3. ์ธ์ฆ ์ฝ”๋“œ ๋ฐœ์†ก

POST /auth/sendVerificationCode?email=user@example.com

์‘๋‹ต: ์ธ์ฆ ์ฝ”๋“œ ๋ฐœ์†ก ์™„๋ฃŒ ๋ฉ”์‹œ์ง€

4. ์ธ์ฆ ์ฝ”๋“œ ํ™•์ธ

POST /auth/checkVerificationCode?email=user@example.com&code=123456

์‘๋‹ต: ์ธ์ฆ ์™„๋ฃŒ ๋ฉ”์‹œ์ง€

5. ํšŒ์›๊ฐ€์ž…

POST /auth/register
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "password123",
  "name": "ํ™๊ธธ๋™"
}

์‘๋‹ต: ํšŒ์›๊ฐ€์ž… ์™„๋ฃŒ ๋ฉ”์‹œ์ง€

6. ๋กœ๊ทธ์ธ

POST /auth/login
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "password123"
}

์‘๋‹ต:

{
  "accessToken": "eyJhbGciOiJIUzI1NiIs...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIs..."
}

7. ๊ตฌ๊ธ€ ๋กœ๊ทธ์ธ

POST /auth/login/google
Content-Type: application/json

{
  "idToken": "google_id_token"
}

์‘๋‹ต: Access Token + Refresh Token

8. ์นด์นด์˜ค ๋กœ๊ทธ์ธ

POST /auth/login/kakao
Content-Type: application/json

{
  "email": "user@example.com",
  "name": "ํ™๊ธธ๋™"
}

์‘๋‹ต: Access Token + Refresh Token

9. ๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ •

POST /auth/updatePassword
Content-Type: application/json

{
  "email": "user@example.com",
  "newPassword": "newPassword123"
}

์‘๋‹ต: ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณ€๊ฒฝ ์™„๋ฃŒ ๋ฉ”์‹œ์ง€


์ธ์ฆ ํ•„์š” API

๋ชจ๋“  ์ธ์ฆ ํ•„์š” API๋Š” ํ—ค๋”์— ๋‹ค์Œ์„ ํฌํ•จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:

Authorization: Bearer {accessToken}

1. ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณ€๊ฒฝ

POST /auth/changePassword
Authorization: Bearer {token}
Content-Type: application/json

{
  "currentPassword": "oldPassword",
  "newPassword": "newPassword123"
}

2. ๋กœ๊ทธ์•„์›ƒ

POST /auth/logout
Authorization: Bearer {token}
Refresh-Token: {refreshToken}

3. ํšŒ์› ํƒˆํ‡ด

POST /auth/unregister
Authorization: Bearer {token}

4. ํ† ํฐ ๊ฐฑ์‹ 

POST /auth/refresh-token
Authorization: Bearer {refreshToken}

์‘๋‹ต: ์ƒˆ๋กœ์šด Access Token

5. ํ† ํฐ ๊ฒ€์ฆ

GET /auth/validate-token
Authorization: Bearer {token}

์‘๋‹ต: 200 (์œ ํšจ) ๋˜๋Š” 401 (๋ฌดํšจ)


๐Ÿ‘ค ์‚ฌ์šฉ์ž ํ”„๋กœํ•„ API

1. ๋‚ด ํ”„๋กœํ•„ ์กฐํšŒ

GET /auth/profile
Authorization: Bearer {token}

์‘๋‹ต:

{
  "userReferenceId": "uuid",
  "email": "user@example.com",
  "name": "ํ™๊ธธ๋™",
  "profileImageUrl": "https://...",
  "introduction": "์•ˆ๋…•ํ•˜์„ธ์š”",
  "isPrivate": false
}

2. ํ”„๋กœํ•„ ์ˆ˜์ •

POST /auth/updateProfile
Authorization: Bearer {token}
Content-Type: application/json

{
  "name": "ํ™๊ธธ๋™",
  "introduction": "์•ˆ๋…•ํ•˜์„ธ์š”",
  "isPrivate": false
}

3. ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ

POST /auth/updateProfileImage
Authorization: Bearer {token}
Content-Type: multipart/form-data

file: [์ด๋ฏธ์ง€ ํŒŒ์ผ]

4. ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ์‚ญ์ œ

POST /auth/deleteProfileImage
Authorization: Bearer {token}

5. ์‚ฌ์šฉ์ž ๊ฒ€์ƒ‰

POST /auth/findUser
Authorization: Bearer {token}
Content-Type: application/json

{
  "email": "user@example.com",
  "name": "ํ™๊ธธ๋™"
}

์‘๋‹ต: ์‚ฌ์šฉ์ž ํ”„๋กœํ•„ ๋ชฉ๋ก


๐Ÿ‘ฅ ํŒ”๋กœ์šฐ API

1. ํŒ”๋กœ์šฐ

POST /auth/follow
Authorization: Bearer {token}
Content-Type: application/json

{
  "followedEmail": "target@example.com"
}

2. ์–ธํŒ”๋กœ์šฐ

POST /auth/unfollow
Authorization: Bearer {token}
Content-Type: application/json

{
  "followedEmail": "target@example.com"
}

3. ๋‚ด ํŒ”๋กœ์ž‰ ๋ชฉ๋ก ์กฐํšŒ

GET /auth/following
Authorization: Bearer {token}

์‘๋‹ต: ํŒ”๋กœ์ž‰ ์‚ฌ์šฉ์ž ๋ชฉ๋ก

4. ๋‚ด ํŒ”๋กœ์›Œ ๋ชฉ๋ก ์กฐํšŒ

GET /auth/followers
Authorization: Bearer {token}

์‘๋‹ต: ํŒ”๋กœ์›Œ ์‚ฌ์šฉ์ž ๋ชฉ๋ก

5. ํŠน์ • ์‚ฌ์šฉ์ž์˜ ํŒ”๋กœ์ž‰ ๋ชฉ๋ก

GET /auth/followings/{email}
Authorization: Bearer {token}

6. ํŠน์ • ์‚ฌ์šฉ์ž์˜ ํŒ”๋กœ์›Œ ๋ชฉ๋ก

GET /auth/followers/{email}
Authorization: Bearer {token}

๐Ÿ“ ์นดํ…Œ๊ณ ๋ฆฌ API

1. ์นดํ…Œ๊ณ ๋ฆฌ ์ƒ์„ฑ

POST /category/
Authorization: Bearer {token}
Content-Type: application/json

{
  "title": "์—…๋ฌด",
  "color": "#FF5733"
}

์‘๋‹ต:

{
  "categoryId": 1,
  "title": "์—…๋ฌด",
  "color": "#FF5733"
}

2. ๋‚ด ์นดํ…Œ๊ณ ๋ฆฌ ๋ชฉ๋ก ์กฐํšŒ

GET /category/
Authorization: Bearer {token}

3. ํŠน์ • ์‚ฌ์šฉ์ž ์นดํ…Œ๊ณ ๋ฆฌ ์กฐํšŒ

GET /category/{email}
Authorization: Bearer {token}

4. ์นดํ…Œ๊ณ ๋ฆฌ ์ˆ˜์ •

PUT /category/{categoryId}
Authorization: Bearer {token}
Content-Type: application/json

{
  "title": "๊ฐœ์ธ",
  "color": "#3498DB"
}

5. ์นดํ…Œ๊ณ ๋ฆฌ ์‚ญ์ œ

DELETE /category/?categoryIds=1,2,3
Authorization: Bearer {token}

Query Parameter: ์‚ญ์ œํ•  ์นดํ…Œ๊ณ ๋ฆฌ ID ๋ชฉ๋ก


โœ… Todo API

1. Todo ์ƒ์„ฑ

POST /todo/
Authorization: Bearer {token}
Content-Type: application/json

{
  "title": "ํšŒ์˜ ์ค€๋น„ํ•˜๊ธฐ",
  "date": "2024-10-21",
  "categoryId": 1,
  "isCompleted": false
}

2. ์—ฌ๋Ÿฌ Todo ํ•œ๋ฒˆ์— ์ƒ์„ฑ

POST /todo/todos
Authorization: Bearer {token}
Content-Type: application/json

{
  "todos": [
    {
      "title": "ํšŒ์˜ ์ค€๋น„",
      "date": "2024-10-21",
      "categoryId": 1
    },
    {
      "title": "๋ณด๊ณ ์„œ ์ž‘์„ฑ",
      "date": "2024-10-21",
      "categoryId": 1
    }
  ]
}

3. ๋‚ด Todo ๋ชฉ๋ก ์กฐํšŒ

GET /todo/
Authorization: Bearer {token}

์‘๋‹ต: Todo ๋ชฉ๋ก

4. ํŠน์ • ์‚ฌ์šฉ์ž Todo ์กฐํšŒ

GET /todo/{email}
Authorization: Bearer {token}

5. Todo ์ˆ˜์ •

PUT /todo/{todoId}
Authorization: Bearer {token}
Content-Type: application/json

{
  "title": "ํšŒ์˜ ์ค€๋น„ ์™„๋ฃŒ",
  "date": "2024-10-21",
  "categoryId": 1,
  "isCompleted": true
}

6. Todo ์‚ญ์ œ

DELETE /todo/{todoId}
Authorization: Bearer {token}

7. ์—ฌ๋Ÿฌ Todo ์‚ญ์ œ

DELETE /todo/todos?todoIds=1,2,3
Authorization: Bearer {token}

๐Ÿ“… Someday API

1. Someday ์ƒ์„ฑ

POST /todo_someday/
Authorization: Bearer {token}
Content-Type: application/json

{
  "title": "์–ธ์  ๊ฐ€ ํ•ด์•ผ ํ•  ์ผ",
  "categoryId": 1
}

2. Someday ๋ชฉ๋ก ์กฐํšŒ

GET /todo_someday/
Authorization: Bearer {token}

3. Someday ์ˆ˜์ •

PUT /todo_someday/{todoSomedayId}
Authorization: Bearer {token}
Content-Type: application/json

{
  "title": "์ˆ˜์ •๋œ ์ œ๋ชฉ",
  "categoryId": 2
}

4. Someday ์‚ญ์ œ

DELETE /todo_someday/{todoSomedayId}
Authorization: Bearer {token}

๐ŸŽจ ์Šคํ‹ฐ์ปค API

1. ์Šคํ‹ฐ์ปค ์ƒ์„ฑ

POST /sticker/
Authorization: Bearer {token}
Content-Type: application/json

{
  "name": "ํ•˜ํŠธ ์Šคํ‹ฐ์ปค",
  "imageUrl": "https://..."
}

2. ๋‚ด ์Šคํ‹ฐ์ปค ๋ชฉ๋ก ์กฐํšŒ

GET /sticker/
Authorization: Bearer {token}

์‘๋‹ต:

[
  {
    "stickerId": 1,
    "name": "ํ•˜ํŠธ ์Šคํ‹ฐ์ปค",
    "imageUrl": "https://..."
  }
]

3. ์Šคํ‹ฐ์ปค ์‚ญ์ œ

DELETE /sticker/{stickerId}
Authorization: Bearer {token}

๐Ÿช ์ƒ์  API

์Šคํ‹ฐ์ปค ์ƒ์ 

1. ์Šคํ‹ฐ์ปค ์ƒ์  ๋ชฉ๋ก

GET /shop_sticker/
Authorization: Bearer {token}

์‘๋‹ต:

[
  {
    "shopStickerId": 1,
    "name": "ํ”„๋ฆฌ๋ฏธ์—„ ์Šคํ‹ฐ์ปค",
    "price": 1000,
    "imageUrl": "https://...",
    "description": "ํ”„๋ฆฌ๋ฏธ์—„ ์Šคํ‹ฐ์ปค์ž…๋‹ˆ๋‹ค"
  }
]

2. ์ธ๊ธฐ ์Šคํ‹ฐ์ปค ๋ชฉ๋ก (ํŒ๋งค๋Ÿ‰ ์ˆœ)

GET /shop_sticker/sales
Authorization: Bearer {token}

์ปฌ๋Ÿฌ ์ƒ์ 

1. ์ปฌ๋Ÿฌ ์ƒ์  ๋ชฉ๋ก

GET /shop_color/
Authorization: Bearer {token}

์‘๋‹ต:

[
  {
    "shopColorId": 1,
    "name": "๋ฏผํŠธ ์ปฌ๋Ÿฌ",
    "price": 500,
    "colorCode": "#98D8C8"
  }
]

2. ์ธ๊ธฐ ์ปฌ๋Ÿฌ ๋ชฉ๋ก (ํŒ๋งค๋Ÿ‰ ์ˆœ)

GET /shop_color/sales
Authorization: Bearer {token}

๐Ÿ’ณ ๊ตฌ๋งค API

์Šคํ‹ฐ์ปค ๊ตฌ๋งค

1. ์Šคํ‹ฐ์ปค ๊ตฌ๋งค

POST /purchase_sticker/
Authorization: Bearer {token}
Content-Type: application/json

{
  "shopStickerId": 1
}

์‘๋‹ต:

{
  "purchaseStickerId": 1,
  "shopStickerId": 1,
  "purchaseDate": "2024-10-21T10:30:00"
}

2. ๋‚ด ๊ตฌ๋งค ์Šคํ‹ฐ์ปค ๋ชฉ๋ก

GET /purchase_sticker/
Authorization: Bearer {token}

์ปฌ๋Ÿฌ ๊ตฌ๋งค

1. ์ปฌ๋Ÿฌ ๊ตฌ๋งค

POST /purchase_color/
Authorization: Bearer {token}
Content-Type: application/json

{
  "shopColorId": 1
}

2. ๋‚ด ๊ตฌ๋งค ์ปฌ๋Ÿฌ ๋ชฉ๋ก

GET /purchase_color/
Authorization: Bearer {token}

๐ŸŽŸ๏ธ ์ฟ ํฐ API

1. ์ฟ ํฐ ๋ชฉ๋ก ์กฐํšŒ

GET /coupon/
Authorization: Bearer {token}

์‘๋‹ต:

[
  {
    "couponId": 1,
    "name": "์‹ ๊ทœ ํšŒ์› ์ฟ ํฐ",
    "discountAmount": 1000,
    "expiryDate": "2024-12-31"
  }
]

2. ์ฟ ํฐ ์‚ฌ์šฉ

POST /coupon/
Authorization: Bearer {token}
Content-Type: application/json

{
  "couponId": 1
}

์‘๋‹ต:

{
  "usageId": 1,
  "couponId": 1,
  "usedAt": "2024-10-21T10:30:00"
}

3. ์ฟ ํฐ ์‚ฌ์šฉ ๋‚ด์—ญ ์กฐํšŒ

GET /coupon_usage/
Authorization: Bearer {token}

๐Ÿ“ ๊ณตํ†ต ์‘๋‹ต ํ˜•์‹

์„ฑ๊ณต ์‘๋‹ต

{
  "data": { },
  "message": "์„ฑ๊ณต ๋ฉ”์‹œ์ง€"
}

์—๋Ÿฌ ์‘๋‹ต

{
  "status": 400,
  "code": "ERROR_CODE",
  "message": "์—๋Ÿฌ ๋ฉ”์‹œ์ง€"
}

๐Ÿ”‘ ์ธ์ฆ ํ—ค๋”

๋ชจ๋“  ์ธ์ฆ์ด ํ•„์š”ํ•œ API๋Š” ๋‹ค์Œ ํ—ค๋”๋ฅผ ํฌํ•จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:

Authorization: Bearer {accessToken}

Refresh Token์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ:

Refresh-Token: {refreshToken}

๐Ÿ“Œ ์ฐธ๊ณ ์‚ฌํ•ญ

  1. Swagger UI: http://localhost:8080/swagger-ui.html ์—์„œ ์‹ค์‹œ๊ฐ„ API ํ…Œ์ŠคํŠธ ๊ฐ€๋Šฅ
  2. ๋‚ ์งœ ํ˜•์‹: YYYY-MM-DD
  3. ์‹œ๊ฐ„ ํ˜•์‹: ISO 8601 (YYYY-MM-DDTHH:mm:ss)
  4. ํ† ํฐ ๋งŒ๋ฃŒ: Access Token - 1์‹œ๊ฐ„, Refresh Token - 7์ผ
  5. ํŒŒ์ผ ์—…๋กœ๋“œ: multipart/form-data ํ˜•์‹ ์‚ฌ์šฉ
  6. ์ตœ๋Œ€ ํŒŒ์ผ ํฌ๊ธฐ: 10MB

๐Ÿ› ์—๋Ÿฌ ์ฝ”๋“œ

์ฝ”๋“œ ์„ค๋ช…
400 ์ž˜๋ชป๋œ ์š”์ฒญ
401 ์ธ์ฆ ์‹คํŒจ
403 ๊ถŒํ•œ ์—†์Œ
404 ๋ฆฌ์†Œ์Šค ์—†์Œ
409 ์ถฉ๋Œ (์ค‘๋ณต ๋“ฑ)
500 ์„œ๋ฒ„ ์—๋Ÿฌ

๋” ์ž์„ธํ•œ ๋‚ด์šฉ์€ Swagger ๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.