This repository was archived by the owner on Jan 11, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSearchController.java
More file actions
449 lines (408 loc) · 25.8 KB
/
SearchController.java
File metadata and controls
449 lines (408 loc) · 25.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
package com.example.spot.web.controller;
import com.example.spot.api.ApiResponse;
import com.example.spot.api.code.status.SuccessStatus;
import com.example.spot.domain.enums.StudySortBy;
import com.example.spot.domain.enums.ThemeType;
import com.example.spot.security.utils.SecurityUtils;
import com.example.spot.service.study.StudyCommandService;
import com.example.spot.service.study.StudyQueryService;
import com.example.spot.web.dto.search.SearchRequestStudyDTO;
import com.example.spot.web.dto.search.SearchRequestStudyWithThemeDTO;
import com.example.spot.web.dto.search.SearchResponseDTO.HotKeywordDTO;
import com.example.spot.web.dto.search.SearchResponseDTO.MyPageDTO;
import com.example.spot.web.dto.search.SearchResponseDTO.StudyPreviewDTO;
import com.example.spot.web.dto.search.StudyHistoryResponseDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.PageRequest;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/spot")
@RequiredArgsConstructor
@Validated
@Slf4j
public class SearchController {
private final StudyQueryService studyQueryService;
private final StudyCommandService studyCommandService;
/* ----------------------------- 메인 화면 ------------------------------------- */
@Tag(name = "메인 화면", description = "메인 화면 API")
@GetMapping("/search/studies/main/recommend")
@Operation(summary = "[메인 화면] 회원 별 추천 스터디 3개 조회",
description = """
## [메인 화면] 접속한 회원의 추천 스터디 3개를 조회 합니다.
조회된 스터디 3개의 정보가 반환 됩니다.""",
security = @SecurityRequirement(name = "accessToken"))
public ApiResponse<StudyPreviewDTO> recommendStudiesForMain() {
StudyPreviewDTO recommendStudies = studyQueryService.findRecommendStudies(SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, recommendStudies);
}
@Tag(name = "메인 화면", description = "메인 화면 API")
@GetMapping("/search/studies/main/interested")
@Operation(summary = "[메인 화면] 회원 별 관심 Best 스터디 3개 조회",
description = """
## [메인 화면] 관심 Best 스터디 3개를 조회 합니다.
조회된 스터디 3개의 정보가 반환 됩니다.""",
security = @SecurityRequirement(name = "accessToken"))
public ApiResponse<StudyPreviewDTO> interestedStudiesForMain() {
StudyPreviewDTO recommendStudies = studyQueryService.findInterestedStudies(SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, recommendStudies);
}
@Tag(name = "마이 페이지", description = "마이 페이지 API")
@GetMapping("/search/studies/my-page")
@Operation(summary = "[마이 페이지] 마이 페이지 내 스터디 정보 조회",
description = """
## [마이 페이지] 마이 페이지에 들어갈 나와 관련된 스터디 갯수 정보를 조회합니다.
스터디 갯수 정보와 내 이름이 반환 됩니다.""",
security = @SecurityRequirement(name = "accessToken"))
public ApiResponse<MyPageDTO> myPage() {
MyPageDTO myPageStudyCount = studyQueryService.getMyPageStudyCount(SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, myPageStudyCount);
}
// 전체 스터디 조회
@Tag(name = "전체 스터디 조회", description = "전체 스터디 조회 API")
@GetMapping("/search/studies/all")
@Operation(
summary = "[전체 스터디 조회] 전체 스터디 조회",
description = """
## [전체 스터디 조회] 입력한 조건에 맞는 전체 스터디를 조회 합니다.
조건에 맞게 검색된 스터디 목록이 반환 됩니다."""
)
public ApiResponse<StudyPreviewDTO> allStudiesByConditions(
@ModelAttribute @Valid SearchRequestStudyDTO searchRequestStudyDTO,
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size,
@RequestParam StudySortBy sortBy) {
// 메소드 구현
StudyPreviewDTO studies = studyQueryService.findStudiesByConditions(PageRequest.of(page, size),
searchRequestStudyDTO, sortBy);
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
}
@Tag(name = "전체 스터디 조회", description = "전체 스터디 조회 API")
@GetMapping("/search/studies/all/no-conditions")
@Operation(
summary = "[전체 스터디 조회] 전체 스터디 조회 (조건 X)",
description = """
## [전체 스터디 조회] 전체 스터디를 조회 합니다.
조건에 맞게 검색된 스터디 목록이 반환 됩니다."""
)
public ApiResponse<StudyPreviewDTO> allStudiesByConditions(
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size,
@RequestParam StudySortBy sortBy) {
// 메소드 구현
StudyPreviewDTO studies = studyQueryService.findStudies(PageRequest.of(page, size), sortBy);
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
}
/* ----------------------------- 내 관심 분야 별 스터디 조회 ------------------------------------- */
@Tag(name = "내 관심사 스터디 조회", description = "내 관심사 스터디 조회 API")
@GetMapping("/search/studies/interest-themes/all")
@Operation(
summary = "[내 관심사 스터디 조회] 내 '전체' 관심사 스터디 조회",
description = """
## [내 관심사 스터디 조회] 입력한 조건에 맞는 회원의 전체 관심 분야의 스터디를 조회 합니다.
메인 화면에서 사용 하실 경우, 페이지 번호는 0, 페이지 크기는 3으로 설정하여 사용하시면 됩니다.
조건에 맞게 검색된 스터디 목록이 반환 됩니다.""",
security = @SecurityRequirement(name = "accessToken")
)
@Parameter(name = "searchRequestStudyDTO", description = """
조회할 스터디의 검색 조건을 입력 받습니다.
- gender: 성별 (MALE, FEMALE, UNKNOWN)
- minAge: 18 이상의 정수
- maxAge: 60 이하의 정수
- isOnline: 스터디 온라인 진행 여부 (true, false)
- hasFee: 스터디 활동비 유무 (true, false)
- maxFee: 스터디 최대 활동비
- minFee: 스터디 최소 활동비
""", required = false)
@Parameter(name = "page", description = "조회할 페이지 번호를 입력 받습니다. 페이지 번호는 0부터 시작합니다.", required = true)
@Parameter(name = "size", description = "조회할 페이지 크기를 입력 받습니다. 페이지 크기는 1 이상의 정수 입니다. ", required = true)
@Parameter(name = "sortBy", description = "정렬 기준을 입력 받습니다.", required = true)
public ApiResponse<StudyPreviewDTO> interestStudiesByConditionsAll(
@ModelAttribute @Valid SearchRequestStudyDTO searchRequestStudyDTO,
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size,
@RequestParam StudySortBy sortBy
) {
StudyPreviewDTO studies = studyQueryService.findInterestStudiesByConditionsAll(PageRequest.of(page, size),
SecurityUtils.getCurrentUserId(), searchRequestStudyDTO, sortBy);
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
}
@Tag(name = "내 관심사 스터디 조회", description = "내 관심사 스터디 조회 API")
@GetMapping("/search/studies/interest-themes/specific")
@Operation(
summary = "[내 관심사 스터디 조회] 내 '특정' 관심사 스터디 조회",
description = """
## [내 관심사 스터디 조회] 입력한 조건에 맞는 회원의 특정 관심 분야의 스터디를 조회 합니다.
조건에 맞게 검색된 스터디 목록이 반환 됩니다.""",
security = @SecurityRequirement(name = "accessToken")
)
@Parameter(name = "searchRequestStudyDTO", description = """
조회할 스터디의 검색 조건을 입력 받습니다.
- gender: 성별 (MALE, FEMALE, UNKNOWN)
- minAge: 18 이상의 정수
- maxAge: 60 이하의 정수
- isOnline: 스터디 온라인 진행 여부 (true, false)
- hasFee: 스터디 활동비 유무 (true, false)
- maxFee: 스터디 최대 활동비
- minFee: 스터디 최소 활동비
""", required = false)
@Parameter(name = "theme", description = "조회할 관심 분야를 입력 받습니다.", required = true)
@Parameter(name = "page", description = "조회할 페이지 번호를 입력 받습니다. 페이지 번호는 0부터 시작합니다.", required = true)
@Parameter(name = "size", description = "조회할 페이지 크기를 입력 받습니다. 페이지 크기는 1 이상의 정수 입니다. ", required = true)
@Parameter(name = "sortBy", description = "정렬 기준을 입력 받습니다.", required = true)
public ApiResponse<StudyPreviewDTO> interestStudiesByConditionsSpecific(
@RequestParam ThemeType theme,
@ModelAttribute @Valid SearchRequestStudyDTO searchRequestStudyDTO,
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size,
@RequestParam StudySortBy sortBy
) {
StudyPreviewDTO studies = studyQueryService.findInterestStudiesByConditionsSpecific(PageRequest.of(page, size),
SecurityUtils.getCurrentUserId(), searchRequestStudyDTO, theme, sortBy);
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
// 메소드 구현
}
/* ----------------------------- 내 관심 지역 별 스터디 조회 ------------------------------------- */
@Tag(name = "내 관심 지역 스터디 조회", description = "내 관심 지역 스터디 조회 API")
@GetMapping("/search/studies/preferred-region/all")
@Operation(
summary = "[내 관심 지역 스터디 조회] 내 '전체' 관심 지역 스터디 조회",
description = """
## [내 관심 지역 스터디 조회] 입력한 조건에 맞는 회원의 전체 관심 지역의 스터디를 조회 합니다.
조건에 맞게 검색된 스터디 목록이 반환 됩니다.""",
security = @SecurityRequirement(name = "accessToken")
)
@Parameter(name = "searchRequestStudyDTO", description = """
조회할 스터디의 검색 조건을 입력 받습니다.
- gender: 성별 (MALE, FEMALE, UNKNOWN)
- minAge: 18 이상의 정수
- maxAge: 60 이하의 정수
- isOnline: 스터디 온라인 진행 여부 (true, false)
- hasFee: 스터디 활동비 유무 (true, false)
- maxFee: 스터디 최대 활동비
- minFee: 스터디 최소 활동비
""", required = false)
@Parameter(name = "page", description = "조회할 페이지 번호를 입력 받습니다. 페이지 번호는 0부터 시작합니다.", required = true)
@Parameter(name = "size", description = "조회할 페이지 크기를 입력 받습니다. 페이지 크기는 1 이상의 정수 입니다. ", required = true)
@Parameter(name = "sortBy", description = "정렬 기준을 입력 받습니다.", required = true)
public ApiResponse<StudyPreviewDTO> interestRegionStudiesByConditionsAll(
@ModelAttribute @Valid SearchRequestStudyWithThemeDTO searchRequestStudyDTO,
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size,
@RequestParam StudySortBy sortBy
) {
StudyPreviewDTO studies = studyQueryService.findInterestRegionStudiesByConditionsAll(
PageRequest.of(page, size), SecurityUtils.getCurrentUserId(), searchRequestStudyDTO, sortBy);
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
}
@Tag(name = "내 관심 지역 스터디 조회", description = "내 관심 지역 스터디 조회 API")
@GetMapping("/search/studies/preferred-region/specific")
@Operation(
summary = "[내 관심 지역 스터디 조회] 내 '특정' 관심 지역 스터디 조회",
description = """
## [내 관심 지역 스터디 조회] 입력한 조건에 맞는 회원의 특정 관심 지역의 스터디를 조회 합니다.
조건에 맞게 검색된 스터디 목록이 반환 됩니다.""",
security = @SecurityRequirement(name = "accessToken")
)
@Parameter(name = "searchRequestStudyDTO", description = """
조회할 스터디의 검색 조건을 입력 받습니다.
- gender: 성별 (MALE, FEMALE, UNKNOWN)
- minAge: 18 이상의 정수
- maxAge: 60 이하의 정수
- isOnline: 스터디 온라인 진행 여부 (true, false)
- hasFee: 스터디 활동비 유무 (true, false)
- maxFee: 스터디 최대 활동비
- minFee: 스터디 최소 활동비
""", required = false)
@Parameter(name = "regionCode", description = "조회할 지역 코드를 입력 받습니다. 지역 코드는 10자리의 문자열 입니다. ex) 1111051500", required = true)
@Parameter(name = "page", description = "조회할 페이지 번호를 입력 받습니다. 페이지 번호는 0부터 시작합니다.", required = true)
@Parameter(name = "size", description = "조회할 페이지 크기를 입력 받습니다. 페이지 크기는 1 이상의 정수 입니다. ", required = true)
@Parameter(name = "sortBy", description = "정렬 기준을 입력 받습니다.", required = true)
public ApiResponse<StudyPreviewDTO> interestRegionStudiesByConditionsSpecific(
@RequestParam String regionCode,
@ModelAttribute @Valid SearchRequestStudyWithThemeDTO searchRequestStudyDTO,
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size,
@RequestParam StudySortBy sortBy
) {
StudyPreviewDTO studies = studyQueryService.findInterestRegionStudiesByConditionsSpecific(
PageRequest.of(page, size), SecurityUtils.getCurrentUserId(), searchRequestStudyDTO, regionCode, sortBy);
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
}
/* ----------------------------- 모집 중 스터디 조회 ------------------------------------- */
@Tag(name = "모집 중 스터디 조회")
@GetMapping("/search/studies/recruiting")
@Operation(
summary = "[모집 중 스터디 조회] 모집 중인 스터디 조회",
description = """
## [모집 중 스터디 조회] 입력한 조건에 맞는 모집 중인 스터디 전체를 조회 합니다.
조건에 맞게 검색된 스터디 목록이 반환 됩니다."""
)
@Parameter(name = "searchRequestStudyDTO", description = """
조회할 스터디의 검색 조건을 입력 받습니다.
- gender: 성별 (MALE, FEMALE, UNKNOWN)
- minAge: 18 이상의 정수
- maxAge: 60 이하의 정수
- isOnline: 스터디 온라인 진행 여부 (true, false)
- hasFee: 스터디 활동비 유무 (true, false)
- maxFee: 스터디 최대 활동비
- minFee: 스터디 최소 활동비
""", required = false)
@Parameter(name = "page", description = "조회할 페이지 번호를 입력 받습니다. 페이지 번호는 0부터 시작합니다.", required = true)
@Parameter(name = "size", description = "조회할 페이지 크기를 입력 받습니다. 페이지 크기는 1 이상의 정수 입니다. ", required = true)
@Parameter(name = "sortBy", description = "정렬 기준을 입력 받습니다.", required = true)
public ApiResponse<StudyPreviewDTO> recruitingStudiesByConditions(
@ModelAttribute @Valid SearchRequestStudyWithThemeDTO searchRequestStudyDTO,
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size,
@RequestParam StudySortBy sortBy) {
// 메소드 구현
StudyPreviewDTO studies = studyQueryService.findRecruitingStudiesByConditions(PageRequest.of(page, size),
searchRequestStudyDTO, sortBy);
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
}
// 내가 모집 중인 스터디 조회
/* ----------------------------- 찜한 스터디 검색 ------------------------------------- */
@Tag(name = "내 스터디 조회")
@GetMapping("/search/studies/liked")
@Operation(
summary = "[찜한 스터디 조회] 찜한 스터디 조회",
description = """
## [찜한 스터디 조회] 찜한 스터디 전체를 조회 합니다.
찜한 스터디 목록이 반환 됩니다.""",
security = @SecurityRequirement(name = "accessToken")
)
public ApiResponse<StudyPreviewDTO> likedStudies(
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size) {
StudyPreviewDTO studies = studyQueryService.findLikedStudies(SecurityUtils.getCurrentUserId(), PageRequest.of(page, size));
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
}
/* ----------------------------- 스터디 검색 ------------------------------------- */
@Tag(name = "스터디 검색")
@GetMapping("/search/studies")
@Operation(
summary = "[스터디 검색] 키워드를 통한 스터디 검색",
description = """
## [스터디 검색] 제목에 키워드가 포함 되어 있는 스터디 전체를 조회 합니다.
찜한 스터디 목록이 반환 됩니다."""
)
@Parameter(name = "keyword", description = "검색할 키워드를 입력 받습니다.", required = true)
@Parameter(name = "page", description = "조회할 페이지 번호를 입력 받습니다. 페이지 번호는 0부터 시작합니다.", required = true)
@Parameter(name = "size", description = "조회할 페이지 크기를 입력 받습니다. 페이지 크기는 1 이상의 정수 입니다. ", required = true)
@Parameter(name = "sortBy", description = "정렬 기준을 입력 받습니다.", required = true)
public ApiResponse<StudyPreviewDTO> searchStudiesByKeyword(
@RequestParam String keyword,
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size,
@RequestParam StudySortBy sortBy) {
// 메소드 구현
StudyPreviewDTO studies = studyQueryService.findStudiesByKeyword(PageRequest.of(page, size), keyword, sortBy);
// 검색 키워드 저장 -> 검색이 성공적으로 이루어졌을 때만 저장.
// 만약 키워드 검색 결과가 존재하지 않으면 저장하지 않음.
studyCommandService.addHotKeyword(keyword);
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
}
@Tag(name = "스터디 검색")
@GetMapping("/search/studies/hot-keywords")
@Operation(summary = "[스터디 검색] 인기 검색어 조회",
description = """
## [스터디 검색] 현재 스터디 검색에 가장 많이 검색된 검색어를 조회합니다.
인기 검색어는 13시, 18시에 초기화 됩니다. 초기화 된 시간과 현재 인기 검색어 목록을 반환합니다.
""")
public ApiResponse<HotKeywordDTO> getHotKeywords() {
return ApiResponse.onSuccess(SuccessStatus._HOT_KEYWORD_FOUND, studyQueryService.getHotKeyword());
}
/* ----------------------------- 테마 별 스터디 검색 ------------------------------------- */
@Tag(name = "스터디 검색")
@GetMapping("/search/studies/theme/")
@Operation(
summary = "[테마 별 스터디 검색] 테마 별 스터디 검색",
description = """
## [테마 별 스터디 검색] 입력한 테마에 해당하는 스터디 전체를 조회 합니다.
테마 별 스터디 목록이 반환 됩니다."""
)
@Parameter(name = "theme", description = "검색할 테마를 입력 받습니다.", required = true)
@Parameter(name = "page", description = "조회할 페이지 번호를 입력 받습니다. 페이지 번호는 0부터 시작합니다.", required = true)
@Parameter(name = "size", description = "조회할 페이지 크기를 입력 받습니다. 페이지 크기는 1 이상의 정수 입니다. ", required = true)
@Parameter(name = "sortBy", description = "정렬 기준을 입력 받습니다.", required = true)
public ApiResponse<StudyPreviewDTO> searchStudiesByTheme(
@RequestParam ThemeType theme,
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size,
@RequestParam StudySortBy sortBy) {
// 메소드 구현
StudyPreviewDTO studies = studyQueryService.findStudiesByTheme(PageRequest.of(page, size), theme, sortBy);
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
}
/* ----------------------------- 진행중인 스터디 목록 조회 ------------------------------------- */
@Tag(name = "내 스터디 조회")
@Operation(summary = "[참여하고 있는 스터디 조회] 내가 참여하고 있는 스터디 목록 불러오기", description = """
## [진행중인 스터디] 마이페이지 > 진행중 클릭, 로그인한 회원이 참여하고 있는 스터디 목록을 불러옵니다.
로그인한 회원이 참여하는 스터디 중 status = ON인 스터디의 목록이 반환됩니다.
""")
@GetMapping("/search/studies/on-studies")
@Parameter(name = "page", description = "조회할 페이지 번호를 입력 받습니다. 페이지 번호는 0부터 시작합니다.", required = true)
@Parameter(name = "size", description = "조회할 페이지 크기를 입력 받습니다. 페이지 크기는 1 이상의 정수 입니다. ", required = true)
public ApiResponse<StudyPreviewDTO> getAllOnStudies(
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size) {
StudyPreviewDTO studies = studyQueryService.findOngoingStudiesByMemberId(
PageRequest.of(page, size), SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
}
/* ----------------------------- 모집중인 스터디 목록 조회 ------------------------------------- */
@Tag(name = "내 스터디 조회")
@Operation(summary = "[내가 모집중인 스터디] 내가 모집중인 스터디 목록 불러오기", description = """
## [모집중인 스터디] 마이페이지 > 모집중 클릭, 로그인한 회원이 모집중인 스터디 목록을 불러옵니다.
로그인한 회원이 운영하는 스터디 중 study_state = RECRUITING인 스터디의 목록이 반환됩니다.
""")
@GetMapping("/search/studies/my-recruiting-studies")
@Parameter(name = "page", description = "조회할 페이지 번호를 입력 받습니다. 페이지 번호는 0부터 시작합니다.", required = true)
@Parameter(name = "size", description = "조회할 페이지 크기를 입력 받습니다. 페이지 크기는 1 이상의 정수 입니다. ", required = true)
public ApiResponse<StudyPreviewDTO> getAllMyRecruitingStudies(
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size) {
StudyPreviewDTO studies = studyQueryService.findMyRecruitingStudies(
PageRequest.of(page, size), SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
}
/* ----------------------------- 신청한 스터디 목록 조회 ------------------------------------- */
@Tag(name = "내 스터디 조회")
@Operation(summary = "[신청한 스터디] 신청한 스터디 목록 불러오기", description = """
## [신청한 스터디] 마이페이지 > 신청한, 로그인한 회원이 신청한 스터디 목록을 불러옵니다.
로그인한 회원이 신청한 스터디(ApplicationStatus = APPLIED)의 목록이 반환됩니다.
""")
@GetMapping("/search/studies/applied-studies")
@Parameter(name = "page", description = "조회할 페이지 번호를 입력 받습니다. 페이지 번호는 0부터 시작합니다.", required = true)
@Parameter(name = "size", description = "조회할 페이지 크기를 입력 받습니다. 페이지 크기는 1 이상의 정수 입니다. ", required = true)
public ApiResponse<StudyPreviewDTO> getAppliedStudies(
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size) {
StudyPreviewDTO studies = studyQueryService.findAppliedStudies(
PageRequest.of(page, size), SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, studies);
}
/* ----------------------------- 신청한 스터디 목록 조회 ------------------------------------- */
@Tag(name = "마이 페이지")
@Operation(summary = "[마이 페이지] 사용자님의 노력들 조회", description = """
## [마이페이지]
호스트가 종료한 스터디, 그리고 스터디원(호스트포함) 본인이 탈퇴한 스터디의 정보와 스터디 한줄 평가를 조회합니다.
""")
@GetMapping("/search/studies/finished-studies")
public ApiResponse<?> getFinishedStudies(
@RequestParam @Min(0) Integer page,
@RequestParam @Min(1) Integer size
) {
StudyHistoryResponseDTO responseDTO = studyQueryService.getFinishedStudies(PageRequest.of(page, size),
SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, responseDTO);
}
}