From ba8b30862dfe57914ce2804b4f4282a6b946f326 Mon Sep 17 00:00:00 2001 From: Inho Jang <71584696+JangInho@users.noreply.github.com> Date: Sun, 16 Feb 2025 17:35:00 +0900 Subject: [PATCH] =?UTF-8?q?[merge]=20=EC=9A=B4=EC=98=81=20=EC=84=9C?= =?UTF-8?q?=EB=B2=84=20=EB=B0=B0=ED=8F=AC=20(#212)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [fix] #123 csvWriter 필드 변경 * [fix] #123 controller part로 변경 * [fix] #123 AdminController consume설정 * [fix] #123 filepath 수정 * [hotfix]: 긴급 공지 상태 변경 * [chore] #127 actuator 의존성 추가 * [feat] #127 actuator 경로 White list 추가 * [hotfix] groupEntity와 memberEntity 간 조인 조건 명확히 하여 groupCode 관련 경로 표현식 오류 해결 * [fix] #123 getProgram으로 수정 * [fix] #123 JobScope추가 * [fix] #123 getMajor로 다시 수정ㅇ * [hotfix]: 자료집 수정 api 추가 * [hotfix]: 자료집 수정 api 추가 * [hotfix]: 자료집 수정 url 수정 * [hotfix]: 자료집 수정 api 리팩토링 * [hotfix]: 자료집 수정 api 리팩토링 * [hotfix]: 자료집 수정 api 리팩토링 * [hotfix]: 자료집 수정 api 리팩토링 * [hotfix]: 자료집 수정 api 리팩토링 * [chore] #131 board 디비수정 * [hotfix]: 자료집 수정 카테고리 * [hotfix]: 자료집 수정 카테고리 * [hotfix]: 자료집 수정 카테고리 * [hotfix]: 자료집 categort 학부들 추가 * [feat] CORS 학교 도메인 연결!!! * [refactor] 공지사항 게시물 정렬 시 1)긴급공지 2)NEW 3)일반 순으로 최종 재정렬되게 수정 * [refactor] 공지사항 게시물 정렬 시 1)긴급공지 2)NEW 3)일반 순으로 최종 재정렬되게 수정 - 검색도 적용 * [refactor] GroupCode에 CLUB_UNION(동아리연합회) 추가 - 동아리연합회는 멤버에 속하지만 동아리 연합회는 예외적으로 ACL적용을 해야하기 때문에 그룹코드에 추가해야함 - 그래서 동아리 연합회를 그룹코드에 추가하면 코드의 수정이 많지 않을 것이라고 예상(노션 업데이트) * [refactor] ACL TargetGroup에 CLUB_UNION(동아리연합회) 추가 * [hotfix] 게시물 전체 조회 페이지네이션 오류 해결 distinct 추가해서 중복 객체 카운팅 해결 * [refactor] fetchCount -> fetchOne으로 수정 fetchCount는 최신 버전 deprecated * [add] UserInfoResponse 추가(passu) * [add] TokenRequest 추가(passu) * [add] 토큰 유저 정보 조회 로직 * [add] 유저 찾기 로직 * [add] SecurityConfig 경로 추가 * [fix] record to class * [hotfix] 페이징 중복 문제 해결, countDistinct * [hotfix] 페이징 중복 문제 해결, countDistinct * findAllByBoardIdAndGroupCodeAndMemberCode 메소드는 현재 프론트에서 쓰지 않는 메소드이기는 하지만, 함께 수정함(같은 로직이기 때문에) * [refactor] 분실물 게시물 단건 조회 시 학생의 학번도 반환 추가 * [fix] @ResponseBody 삭제 * [fix] Header로 토큰 발급받는 것으로 수정 * [fix] required false설정 * [add] UserInfoResponse of 메소드 추가 * [fix] 우선 간편하게 하나만 찾아서 보내주는 것으로 수정 * [fix] studentId 출력 부분 수정 * [chore] #139 rename 및 타겟 브랜치 메인으로 변경 * [chore] #139 develop 브랜치 cicd * [fix] #139 잘못 기입된 시크릿명 수정 * [refactor] : 게시물 생성 dto 공통 추상클래스로 만들기 * [refactor] #139 현재 브랜치 배포 대상 제외 * [refactor] : 팩토리로 게시판별 게시물 처리 * [feat]:인권신고게시판 추가 엔티티 생성 * [refactor]:배포 문제해결 * [feat]:#142 CustomReqeustBody, 게시물 delete 수정 * [fix]:#142 swagger 연결 서버 도메인 변경 * [fix]:#142 게시물 생성 description변경 * [feat] 건의게시판 답변대기 카테고리 추가 * [fix]: #142 전화번호 필드 추가 * [feat] 건의게시판 조회 * [feat] 건의게시판 단건조회 * [feat]: #142 인권신고게시판 조회 ACL 적용 * [feat]:#142 인권신고게시판 단건조회 * [feat]:#142 인권신고게시판 글쓰기 ACL추가 * Revert "[feat]:#142 인권신고게시판 단건조회" This reverts commit 3d643bc7ff72c0fba48886a566cb655061716cf5. * [fix]:#142 파일추가 * [feat]: 인권신고게시판 공식답변 처리 * [fix]: swagger description 수정 * Revert "Revert "[feat]:#142 인권신고게시판 단건조회"" This reverts commit 5218dd2c44d88ec7402859dce8b6f892fcf9979d. * [fix] 예술창작학부에 속한 문예창작전공, 영화예술전공 예외처리 코드 * [fix] 예술창작학부에 속한 문예창작전공, 영화예술전공 예외처리 코드 * [feat] 건의게시판 자치기구 댓글 시 CommentType OFFICIAL로 내려가게 수정 * [feat]:#142 오피셜댓글-> 카테고리 상태변경 * [feat] : #142 에러수정 * [feat] #142 findSuggestionCommitteeMember 널처리 * [feat] #142 SuggestionPostDetailResponse 에 officialCommentList 추가 * [feat] #142 여백 제거 * [fix]:#142 personType 한글로 수정 * [fix]:#142 category, isAuthor, rightsDetailList 필드명 맞추기 * [fix]:#142 postFileList 필드명 변경 * [feat] #142 건의게시판 userId 추가 * [feat]:#142 건의대상 타입 필드 추가 * [feat] #142 suggestionTarget 널처리 * [feat] #142 suggestionTarget 널처리 * [feat] #142 건의게시판 조회 * [fix]:#142 단건조회 category 필드명 수정 * [fix] :#142 SuggestionTarget null 이슈 해결 * [fix] : #142 인권신고게시물생성 category 상수화 * Revert "[fix] : #142 인권신고게시물생성 category 상수화" This reverts commit 995fdea2e04c716f3645f9f00f34a7d5a664c409. * [feat] : #142 인권신고게시물 패치 API 생성 * [feat] : #142 인권게시판 일반로그인 유저 리스트조회 수정 * [feat] : #142 건의게시판 일반로그인 유저 리스트조회 수정 * [feat]:#142 페이지 정보처리 * [feat]:#142 페이지 정보처리2 * [fix]:#142 인권신고 게시판 일반 유저 ACL추가 * [fix]:#142 카테고리 상수화 * [feat]:#142 인권신고게시판 patch 수정 * [feat]:#142 board-8 patch시 에러처리 * [feat] 프론트 도메인 추가 * [fix]:비로그인 처리 * [fix]:category 필드 다중매핑 * [feat]:비로그인 목록조회 처리 * [refactor] : #142 목록조회 엔드포인트 변경 및 리팩토링 * [feat]:#142 rightsDetail patch 방식 수정 * [fix] : #142 swagger 스키마 * [refactor]: #152 개발 도메인 CORS 설정 * [infra] : #153 yml 수정 배포 * [fix]: #142 타 자치기구 목록조회 수정 * [feat] : #142 댓글 권한 추가 * [feat] : #142 관리자 권한추가 * [feat]: #142 공식댓글 수정 예외처리 * [feat] : #166 서비스 공지사항 board code 추가 * [feat] : #166 서비스 공지사항 리스트 조회 * [feat] : #166 서비스 공지사항 글쓰기 ACL * [feat] : #166 서비스 공지사항 단건 게시물 ACL * [feat] : #166 배치 처리에 서비스 공지사항 추가 * [feat] : #166 acl 리스트 중복 권한 제거 * [feat] : #169 내정보 불러오기(데이터 필드에 대한 기획 확인 필요) * [feat] : #169 내정보 수정하기(union일 경우) * [fix] : #169 내정보 수정하기(union일 경우) * [fix] : #166 서비스 공지사항 단건조회 수정 및 리스트조회에 status추가 * [feat] 로깅 세팅 (#170) * [chore] 로그 파일 ignore 처리 * [feat] 요청 로그 aop * [feat] cicd 스크립트 수정 - logback.xml 설정 추가 * [feat] #169 마이페이지 -> 작성 글 보기 구현 * [feat] cicd 스크립트 수정 * [feat] #179 member 테이블 isVerfied 신입생을 위한 인증상태 추가 및 권한 수정 * [feat] #181 건의게시판 키워드 검색 API 수정(page, q없어도 리스트 내려가게) * feat: 자료집게시판 상세조회 API 분리 구현 - Factory 패턴에서 분리하여 독립적인 API로 구현 - 게시글 번호를 통한 단건조회 기능 분리 * [feat] #185 질의응답게시판 구현 * [feat] #169 예외처리 * [feat] #187 질의응답게시판 검색 API qnaTarget 구분하게 수정 * [feat] #169 작성글조회 컨트롤러 수정 * [feat] : #169 내정보 불러오기(데이터 필드에 대한 기획 확인 필요) * [feat] : #169 내정보 수정하기(union일 경우) * [fix] : #169 내정보 수정하기(union일 경우) * [feat] #169 merge develop * [feat] #169 develop rebase * [feat] #169 예외처리 * [feat] #169 작성글조회 컨트롤러 수정 * [feat] #169 내정보 조회, 내가 쓴 글 조회 API 수정 * [feat] #169 User에 nickname 추가 * [feat] #169 category 필드 응답에서 제외 * [feat] #169 예외처리 * [feat] #169 예외처리 * [feat] #191 질의응답게시판 댓글 수정 * [feat] #185 과/단과대, 총학생회로 조회할 수 있게 수정 * [feat] #185 질의응답게시판 오피셜 댓글 로직 수정 * [feat] #196 swagger cors * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * [feat] LoggingAspect 수정 * Trigger deployment * Trigger deployment * Trigger deployment * [fix] : #166 공지사항 단건조회 status추가 * Trigger deployment * [feat] #204 단과대 학과 조회 api * [feat] #204 단과대 학과 조회 api 수정 * [fix] : swagger 수정 * [chore] develop cicd yml 직접 생성 과정 삭제, 서버 실행 시 동적 생성 * [chore] main cicd yml 생성 방식 변경 - 환경변수로 전달하여 deploy.sh 실행 시 동적 생성 * [test] 개발 서버 cicd test * [fix] 스크립트 문법 오류 수정 * [test] 운영 서버 cicd test * [fix] 운영 서버 resources 디렉토리 생성 추가 * [chore] 시크릿명 오탈 기입 수정 * [chore] 시크릿명 오탈 기입 수정 * [refactor] test 브랜치 제거 * [merge] 최신 배포 사항 반영 #210 * [fix] #123 csv entity 필드 변경 * [fix] #123 csv domain 필드 변경 * [fix] #123 csv mapper 필드 변경 * [fix] #123 csvReader 필드 변경 * [fix] #123 csvWriter 필드 변경 * [fix] #123 controller part로 변경 * [fix] #123 AdminController consume설정 * [fix] #123 filepath 수정 * [hotfix]: 긴급 공지 상태 변경 * [chore] #127 actuator 의존성 추가 * [feat] #127 actuator 경로 White list 추가 * [hotfix] groupEntity와 memberEntity 간 조인 조건 명확히 하여 groupCode 관련 경로 표현식 오류 해결 * [fix] #123 getProgram으로 수정 * [fix] #123 JobScope추가 * [fix] #123 getMajor로 다시 수정ㅇ * [hotfix]: 자료집 수정 api 추가 * [hotfix]: 자료집 수정 api 추가 * [hotfix]: 자료집 수정 url 수정 * [hotfix]: 자료집 수정 api 리팩토링 * [hotfix]: 자료집 수정 api 리팩토링 * [hotfix]: 자료집 수정 api 리팩토링 * [hotfix]: 자료집 수정 api 리팩토링 * [hotfix]: 자료집 수정 api 리팩토링 * [chore] #131 board 디비수정 * [hotfix]: 자료집 수정 카테고리 * [hotfix]: 자료집 수정 카테고리 * [hotfix]: 자료집 수정 카테고리 * [hotfix]: 자료집 categort 학부들 추가 * [feat] CORS 학교 도메인 연결!!! * [refactor] 공지사항 게시물 정렬 시 1)긴급공지 2)NEW 3)일반 순으로 최종 재정렬되게 수정 * [refactor] 공지사항 게시물 정렬 시 1)긴급공지 2)NEW 3)일반 순으로 최종 재정렬되게 수정 - 검색도 적용 * [refactor] GroupCode에 CLUB_UNION(동아리연합회) 추가 - 동아리연합회는 멤버에 속하지만 동아리 연합회는 예외적으로 ACL적용을 해야하기 때문에 그룹코드에 추가해야함 - 그래서 동아리 연합회를 그룹코드에 추가하면 코드의 수정이 많지 않을 것이라고 예상(노션 업데이트) * [refactor] ACL TargetGroup에 CLUB_UNION(동아리연합회) 추가 * [hotfix] 게시물 전체 조회 페이지네이션 오류 해결 distinct 추가해서 중복 객체 카운팅 해결 * [refactor] fetchCount -> fetchOne으로 수정 fetchCount는 최신 버전 deprecated * [add] UserInfoResponse 추가(passu) * [add] TokenRequest 추가(passu) * [add] 토큰 유저 정보 조회 로직 * [add] 유저 찾기 로직 * [add] SecurityConfig 경로 추가 * [fix] record to class * [hotfix] 페이징 중복 문제 해결, countDistinct * [hotfix] 페이징 중복 문제 해결, countDistinct * findAllByBoardIdAndGroupCodeAndMemberCode 메소드는 현재 프론트에서 쓰지 않는 메소드이기는 하지만, 함께 수정함(같은 로직이기 때문에) * [refactor] 분실물 게시물 단건 조회 시 학생의 학번도 반환 추가 * [fix] @ResponseBody 삭제 * [fix] Header로 토큰 발급받는 것으로 수정 * [fix] required false설정 * [add] UserInfoResponse of 메소드 추가 * [fix] 우선 간편하게 하나만 찾아서 보내주는 것으로 수정 * [fix] studentId 출력 부분 수정 * [chore] #139 rename 및 타겟 브랜치 메인으로 변경 * [chore] #139 develop 브랜치 cicd * [fix] #139 잘못 기입된 시크릿명 수정 * [refactor] : 게시물 생성 dto 공통 추상클래스로 만들기 * [refactor] #139 현재 브랜치 배포 대상 제외 * [refactor] : 팩토리로 게시판별 게시물 처리 * [feat]:인권신고게시판 추가 엔티티 생성 * [refactor]:배포 문제해결 * [feat]:#142 CustomReqeustBody, 게시물 delete 수정 * [fix]:#142 swagger 연결 서버 도메인 변경 * [fix]:#142 게시물 생성 description변경 * [feat] 건의게시판 답변대기 카테고리 추가 * [fix]: #142 전화번호 필드 추가 * [feat] 건의게시판 조회 * [feat] 건의게시판 단건조회 * [feat]: #142 인권신고게시판 조회 ACL 적용 * [feat]:#142 인권신고게시판 단건조회 * [feat]:#142 인권신고게시판 글쓰기 ACL추가 * Revert "[feat]:#142 인권신고게시판 단건조회" This reverts commit 3d643bc7ff72c0fba48886a566cb655061716cf5. * [fix]:#142 파일추가 * [feat]: 인권신고게시판 공식답변 처리 * [fix]: swagger description 수정 * Revert "Revert "[feat]:#142 인권신고게시판 단건조회"" This reverts commit 5218dd2c44d88ec7402859dce8b6f892fcf9979d. * [fix] 예술창작학부에 속한 문예창작전공, 영화예술전공 예외처리 코드 * [fix] 예술창작학부에 속한 문예창작전공, 영화예술전공 예외처리 코드 * [feat] 건의게시판 자치기구 댓글 시 CommentType OFFICIAL로 내려가게 수정 * [feat]:#142 오피셜댓글-> 카테고리 상태변경 * [feat] : #142 에러수정 * [feat] #142 findSuggestionCommitteeMember 널처리 * [feat] #142 SuggestionPostDetailResponse 에 officialCommentList 추가 * [feat] #142 여백 제거 * [fix]:#142 personType 한글로 수정 * [fix]:#142 category, isAuthor, rightsDetailList 필드명 맞추기 * [fix]:#142 postFileList 필드명 변경 * [feat] #142 건의게시판 userId 추가 * [feat]:#142 건의대상 타입 필드 추가 * [feat] #142 suggestionTarget 널처리 * [feat] #142 suggestionTarget 널처리 * [feat] #142 건의게시판 조회 * [fix]:#142 단건조회 category 필드명 수정 * [fix] :#142 SuggestionTarget null 이슈 해결 * [fix] : #142 인권신고게시물생성 category 상수화 * Revert "[fix] : #142 인권신고게시물생성 category 상수화" This reverts commit 995fdea2e04c716f3645f9f00f34a7d5a664c409. * [feat] : #142 인권신고게시물 패치 API 생성 * [feat] : #142 인권게시판 일반로그인 유저 리스트조회 수정 * [feat] : #142 건의게시판 일반로그인 유저 리스트조회 수정 * [feat]:#142 페이지 정보처리 * [feat]:#142 페이지 정보처리2 * [fix]:#142 인권신고 게시판 일반 유저 ACL추가 * [fix]:#142 카테고리 상수화 * [feat]:#142 인권신고게시판 patch 수정 * [feat]:#142 board-8 patch시 에러처리 * [feat] 프론트 도메인 추가 * [fix]:비로그인 처리 * [fix]:category 필드 다중매핑 * [feat]:비로그인 목록조회 처리 * [refactor] : #142 목록조회 엔드포인트 변경 및 리팩토링 * [feat]:#142 rightsDetail patch 방식 수정 * [fix] : #142 swagger 스키마 * [refactor]: #152 개발 도메인 CORS 설정 * [infra] : #153 yml 수정 배포 * [fix]: #142 타 자치기구 목록조회 수정 * [feat] : #142 댓글 권한 추가 * [feat] : #142 관리자 권한추가 * [feat]: #142 공식댓글 수정 예외처리 * [feat] : #166 서비스 공지사항 board code 추가 * [feat] : #166 서비스 공지사항 리스트 조회 * [feat] : #166 서비스 공지사항 글쓰기 ACL * [feat] : #166 서비스 공지사항 단건 게시물 ACL * [feat] : #166 배치 처리에 서비스 공지사항 추가 * [feat] : #166 acl 리스트 중복 권한 제거 * [feat] : #169 내정보 불러오기(데이터 필드에 대한 기획 확인 필요) * [feat] : #169 내정보 수정하기(union일 경우) * [fix] : #169 내정보 수정하기(union일 경우) * [fix] : #166 서비스 공지사항 단건조회 수정 및 리스트조회에 status추가 * [feat] 로깅 세팅 (#170) * [chore] 로그 파일 ignore 처리 * [feat] 요청 로그 aop * [feat] cicd 스크립트 수정 - logback.xml 설정 추가 * [feat] #169 마이페이지 -> 작성 글 보기 구현 * [feat] cicd 스크립트 수정 * [feat] #179 member 테이블 isVerfied 신입생을 위한 인증상태 추가 및 권한 수정 * [feat] #181 건의게시판 키워드 검색 API 수정(page, q없어도 리스트 내려가게) * feat: 자료집게시판 상세조회 API 분리 구현 - Factory 패턴에서 분리하여 독립적인 API로 구현 - 게시글 번호를 통한 단건조회 기능 분리 * [feat] #185 질의응답게시판 구현 * [feat] #169 예외처리 * [feat] #187 질의응답게시판 검색 API qnaTarget 구분하게 수정 * [feat] #169 작성글조회 컨트롤러 수정 * [feat] : #169 내정보 불러오기(데이터 필드에 대한 기획 확인 필요) * [feat] : #169 내정보 수정하기(union일 경우) * [fix] : #169 내정보 수정하기(union일 경우) * [feat] #169 merge develop * [feat] #169 develop rebase * [feat] #169 예외처리 * [feat] #169 작성글조회 컨트롤러 수정 * [feat] #169 내정보 조회, 내가 쓴 글 조회 API 수정 * [feat] #169 User에 nickname 추가 * [feat] #169 category 필드 응답에서 제외 * [feat] #169 예외처리 * [feat] #169 예외처리 * [feat] #191 질의응답게시판 댓글 수정 * [feat] #185 과/단과대, 총학생회로 조회할 수 있게 수정 * [feat] #185 질의응답게시판 오피셜 댓글 로직 수정 * [feat] #196 swagger cors * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * cicd test * [feat] LoggingAspect 수정 * Trigger deployment * Trigger deployment * Trigger deployment * [fix] : #166 공지사항 단건조회 status추가 * Trigger deployment * [feat] #204 단과대 학과 조회 api * [feat] #204 단과대 학과 조회 api 수정 * [fix] : swagger 수정 * [chore] develop cicd yml 직접 생성 과정 삭제, 서버 실행 시 동적 생성 * [chore] main cicd yml 생성 방식 변경 - 환경변수로 전달하여 deploy.sh 실행 시 동적 생성 * [test] 개발 서버 cicd test * [fix] 스크립트 문법 오류 수정 * [test] 운영 서버 cicd test * [fix] 운영 서버 resources 디렉토리 생성 추가 * [chore] 시크릿명 오탈 기입 수정 * [chore] 시크릿명 오탈 기입 수정 * [refactor] test 브랜치 제거 --------- Co-authored-by: jeongu Co-authored-by: jeongu <66074428+Jeoongu@users.noreply.github.com> Co-authored-by: 배현서 Co-authored-by: chahyunsoo Co-authored-by: jinseok Co-authored-by: qogustj <96872852+qogustj@users.noreply.github.com> Co-authored-by: beakgugong <86966789+beakgugong@users.noreply.github.com> Co-authored-by: JangInho Co-authored-by: Inho Jang <71584696+JangInho@users.noreply.github.com> * [feat] #169 마이페이지 검색 API, 조회 API 응답 수정 --------- Co-authored-by: jeongu Co-authored-by: jeongu <66074428+Jeoongu@users.noreply.github.com> Co-authored-by: 배현서 Co-authored-by: dlswns2480 Co-authored-by: 최인준 <54973090+dlswns2480@users.noreply.github.com> Co-authored-by: chahyunsoo Co-authored-by: jinseok Co-authored-by: qogustj <96872852+qogustj@users.noreply.github.com> Co-authored-by: beakgugong <86966789+beakgugong@users.noreply.github.com> --- .../post/controller/PostManageController.java | 32 +++++-- .../post/service/PostManageService.java | 90 +++++++++++++++++-- .../homepage/domain/post/PostRepository.java | 1 + .../domain/post/service/PostReader.java | 4 + .../infra/jpa/post/PostRepositoryImpl.java | 39 ++++++++ 5 files changed, 153 insertions(+), 13 deletions(-) diff --git a/src/main/java/ussum/homepage/application/post/controller/PostManageController.java b/src/main/java/ussum/homepage/application/post/controller/PostManageController.java index 196cbb37..cc6acbd0 100644 --- a/src/main/java/ussum/homepage/application/post/controller/PostManageController.java +++ b/src/main/java/ussum/homepage/application/post/controller/PostManageController.java @@ -13,7 +13,6 @@ import ussum.homepage.application.post.service.dto.request.PostCreateRequest; import ussum.homepage.application.post.service.dto.request.PostFileDeleteRequest; import ussum.homepage.application.post.service.dto.request.PostUpdateRequest; -import ussum.homepage.application.post.service.dto.request.RightsDetailRequest; import ussum.homepage.application.post.service.dto.response.TopLikedPostListResponse; import ussum.homepage.application.user.service.dto.response.CollegeAndDepartmentResponse; import ussum.homepage.application.user.service.dto.response.MyPostsResponse; @@ -270,11 +269,32 @@ public ResponseEntity> getBoardPost(@PathVariable(name = "postId" 마이페이지 작성 글 보기 조회 시 파라미터로 전달 받은 userId의 유저가 쓴 글 리스트를 조회하는 api입니다. """) @GetMapping("/mypost") - public ResponseEntity getMyPostList(@Parameter(hidden = true) @UserId Long userId, - @RequestParam(value = "page", defaultValue = "0") int page, - @RequestParam(value = "take") int take) { - MyPostsResponse response = postManageService.getMyPostList(userId, page, take); - return ResponseEntity.ok(response); + public ResponseEntity> getMyPostList(@Parameter(hidden = true) @UserId Long userId, + @RequestParam(value = "page", defaultValue = "0") int page, + @RequestParam(value = "take") int take) { + return ApiResponse.success(postManageService.getMyPostList(userId, page, take)); + } + + @Operation(summary = "검색키워드를 활용한 내가 작성한 글 게시물 리스트 조회 api", description = """ + 검색키워드를 활용한 내가 작성한 글 게시물 리스트 조회 api 입니다. + 요청인자에 q는 검색키워드를 의미하여 필수 값은 아닙니다. + """) + @GetMapping("/mypost/search") + public ResponseEntity> searchMyPost(@Parameter(hidden = true) @UserId Long userId, + @RequestParam(value = "page", defaultValue = "0") int page, + @RequestParam(value = "take") int take, + @RequestParam(value = "q",required = false) String q + ) { + return ApiResponse.success(postManageService.searchMyPost(userId, page, take, q)); + } + + @Operation(summary = "단과대 학과 조회 api", description = """ + 단과대 학과 리스트 조회하는 api입니다. + """) + @GetMapping("/colleges-departments") + public ApiResponse getCollegeAndDepartmentList(@Parameter(hidden = true) @UserId Long userId) { + CollegeAndDepartmentResponse response = postManageService.getCollegeAndDepartment(userId); + return ApiResponse.onSuccess(response); } @Operation(summary = "단과대 학과 조회 api", description = """ diff --git a/src/main/java/ussum/homepage/application/post/service/PostManageService.java b/src/main/java/ussum/homepage/application/post/service/PostManageService.java index 39b0f6b0..6144c98f 100644 --- a/src/main/java/ussum/homepage/application/post/service/PostManageService.java +++ b/src/main/java/ussum/homepage/application/post/service/PostManageService.java @@ -2,10 +2,6 @@ import java.util.*; -import io.netty.util.internal.StringUtil; -import java.time.LocalDateTime; -import java.util.*; - import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -18,7 +14,6 @@ import ussum.homepage.application.post.service.dto.request.PostCreateRequest; import ussum.homepage.application.post.service.dto.request.PostFileDeleteRequest; import ussum.homepage.application.post.service.dto.request.PostUpdateRequest; -import ussum.homepage.application.post.service.dto.request.RightsDetailRequest; import ussum.homepage.application.post.service.dto.response.FileResponse; import ussum.homepage.application.post.service.dto.response.SimplePostResponse; import ussum.homepage.application.post.service.dto.response.TopLikedPostListResponse; @@ -387,6 +382,22 @@ public PostListRes searchPost(Long userId, int page, int take, String q, Stri } + public PostListRes searchMyPost(Long userId, int page, int take, String q) { + + Pageable pageable = PageInfo.of(page, take); + Page postList = postReader.searchMyPosts(userId, q, pageable); + PageInfo pageInfo = PageInfo.of(postList); + + List responseList = postList.getContent().stream() + .map(post -> { + int commentCount = Math.toIntExact(postCommentReader.getCommentCountByPostId(post.getId())); + return MyPostResponse.of(post, commentCount); + }) + .toList(); + + return PostListRes.of(responseList, pageInfo); + } + public PostListRes searchDataList(Long userId, int page, int take, String q, String majorCategory, String middleCategory, String subCategory) { Pageable pageable = PageInfo.of(page, take); Page postList = postReader.searchPostListByFileCategories( @@ -441,7 +452,7 @@ public PostDetailRes getDataPost(Long userId, Long postId) { return PostDetailRes.of(response); } - public MyPostsResponse getMyPostList(Long userId, int page, int take) { + public PostListRes getMyPostList(Long userId, int page, int take) { Pageable pageable = PageInfo.of(page, take); Page postList = postReader.getMyPosts(userId, pageable); PageInfo pageInfo = PageInfo.of(postList); @@ -453,7 +464,72 @@ public MyPostsResponse getMyPostList(Long userId, int page, int take) { }) .toList(); - return new MyPostsResponse(list, pageInfo); + return PostListRes.of(list, pageInfo); + } + + public CollegeAndDepartmentResponse getCollegeAndDepartment(Long userId) { + List colleges = List.of( + "경영대학", + "경제통상대학", + "공과대학", + "법과대학", + "사회과학대학", + "인문대학", + "자연과학대학", + "IT대학", + "융합특성화자유전공학부" + ); + + List departments = List.of( + "경영학부", + "벤처중소기업학과", + "회계학과", + "금융학부", + "경제학과", + "글로벌통상학과", + "금융경제학과", + "국제무역학과", + "화학공학과", + "신소재공학과", + "전기공학부", + "기계공학부", + "산업정보시스템공학과", + "건축학부", + "법학과", + "국제법무학과", + "사회복지학부", + "행정학부", + "정치외교학과", + "정보사회학과", + "언론홍보학과", + "평생교육학과", + "기독교학과", + "국어국문학과", + "영어영문학과", + "독어독문학과", + "불어불문학과", + "중어중문학과", + "일어일문학과", + "철학과", + "사학과", + "문예창작전공", + "영화예술전공", + "스포츠학부", + "수학과", + "물리학과", + "화학과", + "정보통계보험수리학과", + "의생명시스템학부", + "컴퓨터학부", + "전자정보공학부", + "글로벌미디어학부", + "소프트웨어학부", + "AI융합학부", + "미디어경영학과", + "융합특성화자유전공학부" + ); + + return CollegeAndDepartmentResponse.of(colleges, departments); } public CollegeAndDepartmentResponse getCollegeAndDepartment(Long userId) { diff --git a/src/main/java/ussum/homepage/domain/post/PostRepository.java b/src/main/java/ussum/homepage/domain/post/PostRepository.java index 010ce4f1..4463aed4 100644 --- a/src/main/java/ussum/homepage/domain/post/PostRepository.java +++ b/src/main/java/ussum/homepage/domain/post/PostRepository.java @@ -43,4 +43,5 @@ public interface PostRepository { Page searchAllByBoardIdAndCategoryAndUserIdTwo(Long boardId, String q, Category category, Pageable pageable, Long userId); Page findAllByUserId(Long userId, Pageable pageable); + Page searchAllByUserId(Long userId, String q, Pageable pageable); } diff --git a/src/main/java/ussum/homepage/domain/post/service/PostReader.java b/src/main/java/ussum/homepage/domain/post/service/PostReader.java index f77b47fd..72d8b16d 100644 --- a/src/main/java/ussum/homepage/domain/post/service/PostReader.java +++ b/src/main/java/ussum/homepage/domain/post/service/PostReader.java @@ -106,4 +106,8 @@ public Page getMyPosts(Long userId, Pageable pageable) { return postRepository.findAllByUserId(userId, pageable); } + public Page searchMyPosts(Long userId, String q, Pageable pageable) { + return postRepository.searchAllByUserId(userId, q, pageable); + } + } diff --git a/src/main/java/ussum/homepage/infra/jpa/post/PostRepositoryImpl.java b/src/main/java/ussum/homepage/infra/jpa/post/PostRepositoryImpl.java index 509f48a1..a45a0a05 100644 --- a/src/main/java/ussum/homepage/infra/jpa/post/PostRepositoryImpl.java +++ b/src/main/java/ussum/homepage/infra/jpa/post/PostRepositoryImpl.java @@ -867,4 +867,43 @@ public Page findAllByUserId(Long userId, Pageable pageable) { countQuery::fetchOne ); } + + public Page searchAllByUserId(Long userId, String q, Pageable pageable) { + // 기본 where 조건: 유저 ID가 일치하는 게시물 필터링 + BooleanBuilder whereClause = new BooleanBuilder(postEntity.userEntity.id.eq(userId)); + if (userId == null) { + return Page.empty(); + } + + // 검색어 q가 지정된 경우, 제목에 해당 검색어가 포함된 게시물만 필터링 + if (q != null && !q.isEmpty()) { + whereClause.and(postEntity.title.like("%" + q + "%")); + } + + // 쿼리 작성: 게시물을 가져오고 페이지네이션 및 정렬 적용 + JPAQuery query = queryFactory + .selectFrom(postEntity) + .where(whereClause) + .orderBy(postEntity.createdAt.desc()); + + // 실제 데이터 가져오기 + List content = query + .offset(pageable.getOffset()) + .limit(pageable.getPageSize()) + .fetch(); + + // 전체 카운트 쿼리: 페이징 정보 생성에 필요 + JPAQuery countQuery = queryFactory + .select(postEntity.count()) + .from(postEntity) + .where(whereClause); + + // 페이지 객체 반환 + return PageableExecutionUtils.getPage( + content.stream().map(postMapper::toDomain).collect(Collectors.toList()), + pageable, + countQuery::fetchOne + ); + } + }