Skip to content

Commit e132c99

Browse files
committed
confliect
2 parents 0c74fdd + 64d7d3d commit e132c99

File tree

52 files changed

+866
-87
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+866
-87
lines changed

src/main/java/com/opendata/docs/CourseControllerDocs.java

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
import com.opendata.domain.course.dto.response.CourseComponentDto;
44
import com.opendata.domain.course.dto.response.CourseResponse;
55
import com.opendata.global.response.ApiResponse;
6+
import com.opendata.global.security.CustomUserDetails;
67
import io.swagger.v3.oas.annotations.Operation;
78
import io.swagger.v3.oas.annotations.responses.ApiResponses;
89
import io.swagger.v3.oas.annotations.tags.Tag;
910
import io.swagger.v3.oas.annotations.media.Content;
1011
import io.swagger.v3.oas.annotations.media.ExampleObject;
1112
import org.springframework.http.ResponseEntity;
13+
import org.springframework.security.core.annotation.AuthenticationPrincipal;
14+
import org.springframework.web.bind.annotation.PathVariable;
1215
import org.springframework.web.bind.annotation.RequestParam;
1316

1417
import java.util.List;
@@ -57,39 +60,40 @@ public interface CourseControllerDocs {
5760
)
5861
})
5962
ResponseEntity<ApiResponse<List<CourseResponse>>> findCourses(
63+
@AuthenticationPrincipal CustomUserDetails customUserDetails,
6064
@RequestParam double lat,
6165
@RequestParam double lon,
6266
@RequestParam String startTime,
6367
@RequestParam String endTime,
6468
@RequestParam String tourspot
6569
);
6670

67-
// @Operation(summary = "관광 코스 좋아요 등록", description = "사용자가 특정 관광 코스를 좋아요할 수 있습니다.")
68-
// @ApiResponses(value = {
69-
// @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "좋아요 등록 성공"),
70-
// @io.swagger.v3.oas.annotations.responses.ApiResponse(
71-
// responseCode = "401",
72-
// description = "인증 실패",
73-
// content = @Content(
74-
// mediaType = "application/json",
75-
// examples = @ExampleObject(
76-
// name = "인증 실패",
77-
// summary = "로그인 필요",
78-
// value = """
79-
// {
80-
// "success": false,
81-
// "code": "COMMON_401",
82-
// "message": "인증이 필요합니다."
83-
// }
84-
// """
85-
// )
86-
// )
87-
// )
88-
// })
89-
// ResponseEntity<ApiResponse<Course>> postCourseLike(
90-
// CustomUserDetails customUserDetails,
91-
// CourseLikeRequest request
92-
// );
71+
@Operation(summary = "관광 코스 좋아요 등록", description = "사용자가 특정 관광 코스를 좋아요할 수 있습니다.")
72+
@ApiResponses(value = {
73+
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "좋아요 등록 성공"),
74+
@io.swagger.v3.oas.annotations.responses.ApiResponse(
75+
responseCode = "401",
76+
description = "인증 실패",
77+
content = @Content(
78+
mediaType = "application/json",
79+
examples = @ExampleObject(
80+
name = "인증 실패",
81+
summary = "로그인 필요",
82+
value = """
83+
{
84+
"success": false,
85+
"code": "COMMON_401",
86+
"message": "인증이 필요합니다."
87+
}
88+
"""
89+
)
90+
)
91+
)
92+
})
93+
ResponseEntity<ApiResponse<Void>> postCourseLike(
94+
@AuthenticationPrincipal CustomUserDetails customUserDetails,
95+
@PathVariable String courseId
96+
);
9397
//
9498
// @Operation(summary = "관광 코스 상세 조회", description = "관광 코스 ID로 세부 스펙(시간대별 장소 등)을 조회합니다.")
9599
// @ApiResponses(value = {
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
package com.opendata.docs;
2+
3+
4+
import com.opendata.domain.course.dto.response.CourseHistoryResponse;
5+
import com.opendata.domain.tourspot.dto.response.TourSpotDetailResponse;
6+
import com.opendata.domain.user.dto.UserResponse;
7+
import com.opendata.global.security.CustomUserDetails;
8+
import io.swagger.v3.oas.annotations.Operation;
9+
import io.swagger.v3.oas.annotations.media.Content;
10+
import io.swagger.v3.oas.annotations.media.ExampleObject;
11+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
12+
import io.swagger.v3.oas.annotations.responses.ApiResponses;
13+
import io.swagger.v3.oas.annotations.tags.Tag;
14+
import org.springframework.http.ResponseEntity;
15+
import org.springframework.security.core.annotation.AuthenticationPrincipal;
16+
import org.springframework.web.bind.annotation.RequestParam;
17+
18+
import java.util.List;
19+
20+
@Tag(name = "마이페이지 API")
21+
public interface MyPageControllerDocs {
22+
@Operation(summary = "과거 코스 조회", description = "현재 코스 포함 사용자 코스 전체 조회")
23+
@ApiResponses(value = {
24+
@ApiResponse(responseCode = "200", description = "사용자 코스 조회 성공"),
25+
@ApiResponse(
26+
responseCode = "401",
27+
description = "인증 실패",
28+
content = @Content(
29+
mediaType = "application/json",
30+
examples = @ExampleObject(
31+
name = "인증 실패 응답",
32+
summary = "유효하지 않은 토큰 또는 로그인 필요",
33+
value = """
34+
{
35+
"success": false,
36+
"code": "COMMON_401",
37+
"message": "인증이 필요합니다."
38+
}
39+
"""
40+
)
41+
)
42+
),
43+
@ApiResponse(
44+
responseCode = "500",
45+
description = "서버 에러",
46+
content = @Content(
47+
mediaType = "application/json",
48+
examples = @ExampleObject(
49+
name = "서버 에러 응답",
50+
summary = "예상치 못한 서버 에러",
51+
value = """
52+
{
53+
"success": false,
54+
"code": "COMMON_500",
55+
"message": "서버 에러, 관리자에게 문의 바랍니다."
56+
}
57+
"""
58+
)
59+
)
60+
)
61+
})
62+
ResponseEntity<com.opendata.global.response.ApiResponse<List<CourseHistoryResponse>>> findCourses(
63+
@AuthenticationPrincipal CustomUserDetails customUserDetails
64+
);
65+
66+
@Operation(summary = "사용자 선호 관광지 추가", description = "사용자가 선호하는 관광지 5개만 추가")
67+
@ApiResponses(value = {
68+
@ApiResponse(responseCode = "200", description = "사용자 선호 관광지 추가 성공"),
69+
@ApiResponse(
70+
responseCode = "401",
71+
description = "인증 실패",
72+
content = @Content(
73+
mediaType = "application/json",
74+
examples = @ExampleObject(
75+
name = "인증 실패 응답",
76+
summary = "유효하지 않은 토큰 또는 로그인 필요",
77+
value = """
78+
{
79+
"success": false,
80+
"code": "COMMON_401",
81+
"message": "인증이 필요합니다."
82+
}
83+
"""
84+
)
85+
)
86+
),
87+
@ApiResponse(
88+
responseCode = "500",
89+
description = "서버 에러",
90+
content = @Content(
91+
mediaType = "application/json",
92+
examples = @ExampleObject(
93+
name = "서버 에러 응답",
94+
summary = "예상치 못한 서버 에러",
95+
value = """
96+
{
97+
"success": false,
98+
"code": "COMMON_500",
99+
"message": "서버 에러, 관리자에게 문의 바랍니다."
100+
}
101+
"""
102+
)
103+
)
104+
)
105+
})
106+
ResponseEntity<com.opendata.global.response.ApiResponse<Void>> updateTourSpot(
107+
@AuthenticationPrincipal CustomUserDetails customUserDetails,
108+
@RequestParam Long tourSpotId
109+
);
110+
111+
@Operation(summary = "사용자 선호 관광지 조회", description = "사용자가 선호하는 관광지 조회")
112+
@ApiResponses(value = {
113+
@ApiResponse(responseCode = "200", description = "사용자 선호 관광지 조회 성공"),
114+
@ApiResponse(
115+
responseCode = "401",
116+
description = "인증 실패",
117+
content = @Content(
118+
mediaType = "application/json",
119+
examples = @ExampleObject(
120+
name = "인증 실패 응답",
121+
summary = "유효하지 않은 토큰 또는 로그인 필요",
122+
value = """
123+
{
124+
"success": false,
125+
"code": "COMMON_401",
126+
"message": "인증이 필요합니다."
127+
}
128+
"""
129+
)
130+
)
131+
),
132+
@ApiResponse(
133+
responseCode = "500",
134+
description = "서버 에러",
135+
content = @Content(
136+
mediaType = "application/json",
137+
examples = @ExampleObject(
138+
name = "서버 에러 응답",
139+
summary = "예상치 못한 서버 에러",
140+
value = """
141+
{
142+
"success": false,
143+
"code": "COMMON_500",
144+
"message": "서버 에러, 관리자에게 문의 바랍니다."
145+
}
146+
"""
147+
)
148+
)
149+
)
150+
})
151+
ResponseEntity<com.opendata.global.response.ApiResponse<List<TourSpotDetailResponse>>> findTourSpot(
152+
@AuthenticationPrincipal CustomUserDetails customUserDetails
153+
);
154+
155+
@Operation(summary = "사용자 선호 관광지 삭제", description = "사용자가 선호 관광지 삭제 가능")
156+
@ApiResponses(value = {
157+
@ApiResponse(responseCode = "200", description = "사용자 선호 관광지 삭제 성공"),
158+
@ApiResponse(
159+
responseCode = "401",
160+
description = "인증 실패",
161+
content = @Content(
162+
mediaType = "application/json",
163+
examples = @ExampleObject(
164+
name = "인증 실패 응답",
165+
summary = "유효하지 않은 토큰 또는 로그인 필요",
166+
value = """
167+
{
168+
"success": false,
169+
"code": "COMMON_401",
170+
"message": "인증이 필요합니다."
171+
}
172+
"""
173+
)
174+
)
175+
),
176+
@ApiResponse(
177+
responseCode = "500",
178+
description = "서버 에러",
179+
content = @Content(
180+
mediaType = "application/json",
181+
examples = @ExampleObject(
182+
name = "서버 에러 응답",
183+
summary = "예상치 못한 서버 에러",
184+
value = """
185+
{
186+
"success": false,
187+
"code": "COMMON_500",
188+
"message": "서버 에러, 관리자에게 문의 바랍니다."
189+
}
190+
"""
191+
)
192+
)
193+
)
194+
})
195+
ResponseEntity<com.opendata.global.response.ApiResponse<Void>> deleteTourSpot(
196+
@AuthenticationPrincipal CustomUserDetails customUserDetails,
197+
@RequestParam Long tourSpotId
198+
);
199+
200+
@Operation(summary = "사용자 조회", description = "사용자 정보(이메일, 멤버쉽, 이름) 조회")
201+
@ApiResponses(value = {
202+
@ApiResponse(responseCode = "200", description = "사용자 정보 조회 성공"),
203+
@ApiResponse(
204+
responseCode = "401",
205+
description = "인증 실패",
206+
content = @Content(
207+
mediaType = "application/json",
208+
examples = @ExampleObject(
209+
name = "인증 실패 응답",
210+
summary = "유효하지 않은 토큰 또는 로그인 필요",
211+
value = """
212+
{
213+
"success": false,
214+
"code": "COMMON_401",
215+
"message": "인증이 필요합니다."
216+
}
217+
"""
218+
)
219+
)
220+
),
221+
@ApiResponse(
222+
responseCode = "500",
223+
description = "서버 에러",
224+
content = @Content(
225+
mediaType = "application/json",
226+
examples = @ExampleObject(
227+
name = "서버 에러 응답",
228+
summary = "예상치 못한 서버 에러",
229+
value = """
230+
{
231+
"success": false,
232+
"code": "COMMON_500",
233+
"message": "서버 에러, 관리자에게 문의 바랍니다."
234+
}
235+
"""
236+
)
237+
)
238+
)
239+
})
240+
ResponseEntity<com.opendata.global.response.ApiResponse<UserResponse>> findUser(
241+
@AuthenticationPrincipal CustomUserDetails customUserDetails
242+
);
243+
}

src/main/java/com/opendata/domain/course/controller/CourseController.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88
import com.opendata.global.response.ApiResponse;
99

10+
import com.opendata.global.security.CustomUserDetails;
1011
import lombok.RequiredArgsConstructor;
1112
import org.springframework.http.ResponseEntity;
13+
import org.springframework.security.core.annotation.AuthenticationPrincipal;
1214
import org.springframework.web.bind.annotation.*;
1315

1416
import java.util.List;
@@ -21,7 +23,7 @@ public class CourseController implements CourseControllerDocs {
2123

2224
@GetMapping
2325
public ResponseEntity<ApiResponse<List<CourseResponse>>> findCourses(
24-
//@AuthenticationPrincipal CustomUserDetails customUserDetails,
26+
@AuthenticationPrincipal CustomUserDetails customUserDetails,
2527
@RequestParam double lat,
2628
@RequestParam double lon,
2729
@RequestParam String startTime,
@@ -34,9 +36,9 @@ public ResponseEntity<ApiResponse<List<CourseResponse>>> findCourses(
3436

3537
@PostMapping("/like/{courseId}")
3638
public ResponseEntity<ApiResponse<Void>> postCourseLike(
37-
// @AuthenticationPrincipal CustomUserDetails customUserDetails,
39+
@AuthenticationPrincipal CustomUserDetails customUserDetails,
3840
@PathVariable String courseId){
39-
courseService.likeCourse(courseId);
41+
courseService.likeCourse(courseId,customUserDetails);
4042
return ResponseEntity.ok(ApiResponse.onSuccessVoid());
4143
}
4244
//
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.opendata.domain.course.dto.response;
2+
3+
import com.fasterxml.jackson.annotation.JsonFormat;
4+
5+
public record CourseComponentHistoryDto(
6+
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
7+
String tourSpotTime,
8+
String tourSpotName,
9+
Long tourspotId,
10+
Double lat, Double lon)
11+
{
12+
13+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.opendata.domain.course.dto.response;
2+
3+
import java.time.LocalDateTime;
4+
import java.util.List;
5+
6+
public record CourseHistoryResponse(
7+
String courseId,
8+
LocalDateTime startDtm,
9+
LocalDateTime endDtm,
10+
List<CourseComponentHistoryDto> history
11+
) {
12+
}

0 commit comments

Comments
 (0)