1. API 목록
2. PUT: 팀 좋아요 토글
해당 팀에 대해 좋아요(찜) 상태를 토글합니다.
-
isLiked: true→ 좋아요 등록 -
isLiked: false→ 좋아요 취소
| 좋아요를 통해 팀을 찜할 수 있습니다. |
| 투표 기간에는 투표만 가능하고, 투표 기간이 아닐 때만 좋아요가 가능합니다. |
| Parameter | Description |
|---|---|
|
좋아요할 팀의 ID |
| Name | Description |
|---|---|
|
Bearer {accessToken} |
HTTP Request
PUT /teams/1/likes HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer member.access.token
Content-Length: 22
Host: localhost:8080
{
"isLiked" : true
}
HTTP Response
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
Content-Length: 91
{
"teamId" : 1,
"isLiked" : true,
"message" : "좋아요가 등록되었습니다."
}
| Path | Type | Description |
|---|---|---|
|
|
좋아요 여부 (true: 등록, false: 취소) |
| Path | Type | Description |
|---|---|---|
|
|
팀 ID |
|
|
좋아요 상태 |
|
|
응답 메시지 |
2.1. 시나리오별 응답
2.1.1. 시나리오 1: TeamLike 데이터가 없는 경우
특정 멤버가 특정 팀에 대해 좋아요 API를 처음 호출하면, TeamLike 테이블에 데이터가 새로 생성됩니다.
| Request isLiked | 응답 메시지 | HTTP 상태 코드 |
|---|---|---|
true |
좋아요가 등록되었습니다. |
200 OK |
false |
아직 좋아요하지 않은 팀입니다. |
400 Bad Request |
2.1.2. 시나리오 2: TeamLike 데이터가 있는 경우
이미 해당 팀에 대한 좋아요 기록이 있는 경우, 상태에 따라 토글됩니다.
| 현재 isLiked | Request isLiked | 응답 메시지 | HTTP 상태 코드 |
|---|---|---|---|
true |
true |
이미 좋아요한 팀입니다. |
400 Bad Request |
true |
false |
좋아요가 취소되었습니다. |
200 OK |
false |
true |
좋아요가 등록되었습니다. |
200 OK |
false |
false |
이미 좋아요를 취소한 팀입니다. |
400 Bad Request |
2.2. ⚠️ 실패 케이스
❌ Case 1: 존재하지 않는 팀
PUT /teams/999/likes HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer member.access.token
Content-Length: 22
Host: localhost:8080
{
"isLiked" : true
}
HTTP/1.1 404 Not Found
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
Content-Length: 53
{
"message" : "팀이 존재하지 않습니다."
}
❌ Case 2: 이미 좋아요한 팀
PUT /teams/1/likes HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer member.access.token
Content-Length: 22
Host: localhost:8080
{
"isLiked" : true
}
HTTP/1.1 400 Bad Request
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
Content-Length: 53
{
"message" : "이미 좋아요한 팀입니다."
}
❌ Case 3: 이미 좋아요 취소한 팀
PUT /teams/1/likes HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer member.access.token
Content-Length: 23
Host: localhost:8080
{
"isLiked" : false
}
HTTP/1.1 400 Bad Request
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
Content-Length: 63
{
"message" : "이미 좋아요를 취소한 팀입니다."
}
❌ Case 4: 좋아요한 적 없는 팀에 취소 요청
PUT /teams/1/likes HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer member.access.token
Content-Length: 23
Host: localhost:8080
{
"isLiked" : false
}
HTTP/1.1 400 Bad Request
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
Content-Length: 63
{
"message" : "아직 좋아요하지 않은 팀입니다."
}
❌ Case 5: 투표 기간 중 좋아요 요청
PUT /teams/1/likes HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer member.access.token
Content-Length: 22
Host: localhost:8080
{
"isLiked" : true
}
HTTP/1.1 400 Bad Request
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json;charset=UTF-8
Content-Length: 94
{
"message" : "현재 투표 기간이므로 해당 작업을 수행할 수 없습니다."
}