Skip to content

Commit a6f4685

Browse files
Merge pull request #186 from prgrms-web-devcourse-final-project/feature/EA3-163-study-post-implement
[EA3-163] Feature: 내 스터디 게시글 검색 조회 추가 및 검색 요청 방식 변경
2 parents 1df9bb3 + 90dabd3 commit a6f4685

File tree

2 files changed

+52
-5
lines changed

2 files changed

+52
-5
lines changed

src/main/java/grep/neogul_coder/domain/studypost/controller/StudyPostSpecification.java

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,54 @@
2020
@Tag(name = "Study-Post", description = "스터디 게시판 API")
2121
public interface StudyPostSpecification {
2222

23-
@Operation(summary = "내 게시글 검색 검색 페이징 조회", description = "스터디에서 내가 쓴 게시글을 검색 조회 합니다.")
23+
@Operation(summary = "내 게시글 검색 검색 페이징 조회", description = """
24+
내 스터디의 게시글을 조건에 따라 페이징하여 조회합니다.
25+
26+
✅ 요청 예시:
27+
`GET /api/studies/{study-id}/posts/search/me?page=0&size=2&sort=createDateTime,DESC&category=NOTICE&keyword=검색
28+
29+
✅ query 설명:
30+
- `page`: 조회할 페이지 번호 (0부터 시작)
31+
32+
- `pageSize`: 한 페이지에 표시할 게시글 수
33+
34+
- `category`: 게시글 카테고리 (예: NOTICE, FREE)
35+
36+
- `keyword`: 게시글 내용 검색 키워드
37+
38+
- `attributeName`: 정렬 대상 속성 (예: commentCount, createDateTime)
39+
40+
- `sort`: 정렬 방향 (ASC 또는 DESC)
41+
42+
✅ 응답 예시:
43+
```json
44+
{
45+
"data": {
46+
"noticePostInfos": [
47+
{
48+
"postId": 3,
49+
"category": "공지",
50+
"title": "스터디 일정 공지",
51+
"createdAt": "2025-07-21"
52+
}
53+
],
54+
"postInfos": [
55+
{
56+
"id": 12,
57+
"title": "모든 국민은 직업선택의 자유를 가진다.",
58+
"category": "NOTICE",
59+
"content": "국회는 의원의 자격을 심사하며, 의원을 징계할 있다.",
60+
"createdDate": "2025-07-10T14:32:00",
61+
"commentCount": 3
62+
}
63+
],
64+
"totalPage": 3,
65+
"totalElementCount": 12,
66+
"hasNext": true
67+
}
68+
}
69+
```
70+
""")
2471
ApiResponse<MyStudyPostPagingResult> getMyPostSearch(long studyId, Pageable pageable, Category category, String keyword, Principal userDetails);
2572

2673
@Operation(summary = "게시글 생성", description = "스터디에 새로운 게시글을 작성합니다.")
@@ -34,7 +81,7 @@ public interface StudyPostSpecification {
3481
✅ 요청 예시:
3582
`GET /api/studies/{study-id}/posts/search?page=0&size=2&sort=createDateTime,DESC&category=NOTICE&keyword=검색
3683
37-
condition 설명:
84+
query 설명:
3885
- `page`: 조회할 페이지 번호 (0부터 시작)
3986
4087
- `pageSize`: 한 페이지에 표시할 게시글 수

src/main/java/grep/neogul_coder/domain/studypost/controller/dto/response/PostInfo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class PostInfo {
1919
private String nickname;
2020

2121
@Schema(description = "작성자 프로필 이미지 URL", example = "https://cdn.example.com/profile.jpg")
22-
private String profileImageUrl;
22+
private String imageUrl;
2323

2424
@Schema(description = "게시글 ID", example = "10")
2525
private Long postId;
@@ -37,11 +37,11 @@ public class PostInfo {
3737
private LocalDateTime createdDate;
3838

3939
@QueryProjection
40-
public PostInfo(long userId, String nickname, String profileImageUrl, Long postId,
40+
public PostInfo(long userId, String nickname, String imageUrl, Long postId,
4141
String title, Category category, String content, LocalDateTime createdDate) {
4242
this.userId = userId;
4343
this.nickname = nickname;
44-
this.profileImageUrl = profileImageUrl;
44+
this.imageUrl = imageUrl;
4545
this.postId = postId;
4646
this.title = title;
4747
this.category = category;

0 commit comments

Comments
 (0)