Skip to content

Commit

Permalink
fix: 파라미터 이름 인식 문제 해결 및 CORS 설정 수정
Browse files Browse the repository at this point in the history
fix: 파라미터 이름 인식 문제 해결 및 CORS 설정 수정
  • Loading branch information
yslle authored Oct 10, 2024
2 parents 65f31f6 + 06116f5 commit 19380c7
Show file tree
Hide file tree
Showing 25 changed files with 198 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-10-04T15:46:49+0900",
date = "2024-10-11T00:42:52+0900",
comments = "version: 1.5.3.Final, compiler: javac, environment: Java 17.0.9 (Oracle Corporation)"
)
public class SseMapStructImpl implements SseMapStruct {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public Post createFaq(@RequestBody Post post, Authentication authentication) {

// faq 리스트 조회(페이지화o)
@GetMapping
public Page<Post> getAllFaq(@RequestParam(value = "page", defaultValue = "1", required = false) int page) {
public Page<Post> getAllFaq(@RequestParam(name = "page", defaultValue = "1", required = false) int page) {
return faqService.getAllFaq(page);
}


// faq 상세 조회
@GetMapping("/{id}")
public Post getFaqDetail(@PathVariable Long id) {
public Post getFaqDetail(@PathVariable(name = "id") Long id) {
String userId = null;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null && authentication.isAuthenticated()) {
Expand All @@ -52,14 +52,14 @@ public Post getFaqDetail(@PathVariable Long id) {

// faq 수정
@PostMapping("/{id}")
public Post updateFaq(@PathVariable Long id, @RequestBody Post requestPost, Authentication authentication) {
public Post updateFaq(@PathVariable(name = "id") Long id, @RequestBody Post requestPost, Authentication authentication) {
Post post = faqService.updateFaq(id, requestPost, authentication);
return post;
}

// faq 삭제
@DeleteMapping("/{id}")
public void deleteFaq(@PathVariable Long id, Authentication authentication) {
public void deleteFaq(@PathVariable(name = "id") Long id, Authentication authentication) {
faqService.deleteFaq(id, authentication);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Page<Post> getAllNotice(@RequestParam(value = "page", defaultValue = "1",

// Notice 상세 조회
@GetMapping("/{id}")
public Post getNoticeDetail(@PathVariable Long id) {
public Post getNoticeDetail(@PathVariable(name = "id") Long id) {
String userId = null;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null && authentication.isAuthenticated()) {
Expand All @@ -59,20 +59,20 @@ public Post getNoticeDetail(@PathVariable Long id) {

// Notice 수정
@PostMapping("/{id}")
public Post updateNotice(@PathVariable Long id, @RequestBody Post requestPost, Authentication authentication) {
public Post updateNotice(@PathVariable(name = "id") Long id, @RequestBody Post requestPost, Authentication authentication) {
Post post = noticeService.updateNotice(id, requestPost, authentication);
return post;
}

// Notice 삭제
@DeleteMapping("/{id}")
public void deleteNotice(@PathVariable Long id, Authentication authentication) {
public void deleteNotice(@PathVariable(name = "id") Long id, Authentication authentication) {
noticeService.deleteNotice(id, authentication);
}

// id로 타입 조회
@GetMapping("/find-type/{id}")
public Optional<Post> findTypeById(@PathVariable Long id, Authentication authentication) {
public Optional<Post> findTypeById(@PathVariable(name = "id") Long id, Authentication authentication) {
return noticeService.findTypeById(id, authentication);
}

Expand All @@ -84,8 +84,8 @@ public Optional<Post> findTypeById(@PathVariable Long id, Authentication authent

// 전체 검색(페이지화o)
@GetMapping("/search")
public Page<Post> searchCommPost(@RequestParam String searchType, @RequestParam String searchWord,
@RequestParam(value = "page", defaultValue = "1", required = false) int page) {
public Page<Post> searchCommPost(@RequestParam(name = "searchType") String searchType, @RequestParam(name = "searchWord") String searchWord,
@RequestParam(name = "page", defaultValue = "1", required = false) int page) {
return noticeService.searchNoticePost(searchType, searchWord, page);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Page<Post> getAllCommunityPost(@RequestParam(value = "page", defaultValue

/* 커뮤니티 게시글 세부 조회 */
@GetMapping("/{id}")
public Post getCommunityPost(@PathVariable Long id) {
public Post getCommunityPost(@PathVariable(name = "id") Long id) {
String userId = null;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
System.out.println(authentication.getName());
Expand All @@ -55,8 +55,8 @@ public Post getCommunityPost(@PathVariable Long id) {

/* 전체 검색 (페이지화) */
@GetMapping("/search")
public Page<Post> searchCommPost(@RequestParam String searchType, @RequestParam String searchWord,
@RequestParam(value = "page", defaultValue = "1", required = false) int page) {
public Page<Post> searchCommPost(@RequestParam(name = "searchType") String searchType, @RequestParam(name = "searchWord") String searchWord,
@RequestParam(name = "page", defaultValue = "1", required = false) int page) {
return comService.searchCommPost(searchType, searchWord, page);
}

Expand All @@ -69,8 +69,8 @@ public Page<Post> searchCommPost(@RequestParam String searchType, @RequestParam

/* 카테고리 - 전체 검색 (페이지화) */
@GetMapping("/search/category")
public Page<Post> searchCommPostByCategory(@RequestParam String searchType, @RequestParam String category,
@RequestParam String searchWord, @RequestParam(value = "page", defaultValue = "1", required = false) int page) {
public Page<Post> searchCommPostByCategory(@RequestParam(name = "searchType") String searchType, @RequestParam(name = "category") String category,
@RequestParam(name = "searchWord") String searchWord, @RequestParam(name = "page", defaultValue = "1", required = false) int page) {
return comService.searchCommPostByCategory(searchType, category, searchWord, page);
}

Expand All @@ -83,14 +83,14 @@ public Post registerCommPost(@RequestBody Post requestPost, Authentication authe

/* 커뮤니티 게시글 수정 */
@PostMapping("/{id}")
public Post updateCommPost(@PathVariable Long id, @RequestBody CommPostRequestDto requestPost, Authentication authentication) {
public Post updateCommPost(@PathVariable(name = "id") Long id, @RequestBody CommPostRequestDto requestPost, Authentication authentication) {
Post post = comService.updateCommPost(id, requestPost, authentication);
return post;
}

/* 커뮤니티 게시글 삭제 */
@DeleteMapping("/{id}")
public boolean deleteCommPost(@PathVariable Long id, Authentication authentication) {
public boolean deleteCommPost(@PathVariable(name = "id") Long id, Authentication authentication) {
return comService.deleteCommPost(id, authentication);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public Post createQna(@RequestBody Post post, Authentication authentication) {

// qna 리스트 조회(페이지화o)
@GetMapping
public Page<Post> getAllQna(@RequestParam(value = "page", defaultValue = "1", required = false) int page) {
public Page<Post> getAllQna(@RequestParam(name = "page", defaultValue = "1", required = false) int page) {
return qnaService.getAllQna(page);
}


// qna 상세 조회
@GetMapping("/{id}")
public Post getQnaDetail(@PathVariable Long id ) {
public Post getQnaDetail(@PathVariable(name = "id") Long id ) {
String userId = null;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null && authentication.isAuthenticated()) {
Expand All @@ -52,20 +52,20 @@ public Post getQnaDetail(@PathVariable Long id ) {

// 수정
@PostMapping("/{id}")
public Post updateQna(@PathVariable Long id, @RequestBody Post requestPost, Authentication authentication) {
public Post updateQna(@PathVariable(name = "id") Long id, @RequestBody Post requestPost, Authentication authentication) {
Post post = qnaService.updateQna(id, requestPost, authentication);
return post;
}

// qna 삭제
@DeleteMapping("/{postId}")
public void deleteQna(@PathVariable Long postId, Authentication authentication) {
public void deleteQna(@PathVariable(name = "id") Long postId, Authentication authentication) {
qnaService.deleteQna(postId, authentication);
}

// faq, qna 최신 순 전체 보기
@GetMapping("/all")
public Page<Post> findAllFaqAndQna(@RequestParam(value = "page", defaultValue = "1", required = false) int page) {
public Page<Post> findAllFaqAndQna(@RequestParam(name = "page", defaultValue = "1", required = false) int page) {
return qnaService.getAllFaqsAndQnas(page);
}

Expand All @@ -77,8 +77,8 @@ public Page<Post> findAllFaqAndQna(@RequestParam(value = "page", defaultValue =

// 전체 검색(페이지화o)
@GetMapping("/search")
public Page<Post> searchQnaAndFaq(@RequestParam String searchType, @RequestParam String searchWord,
@RequestParam(value = "page", defaultValue = "1", required = false) int page) {
public Page<Post> searchQnaAndFaq(@RequestParam(name = "searchType") String searchType, @RequestParam(name = "searchWord") String searchWord,
@RequestParam(name = "page", defaultValue = "1", required = false) int page) {
return qnaService.searchQnaAndFaq(searchType, searchWord, page);
}

Expand All @@ -91,9 +91,9 @@ public Page<Post> searchQnaAndFaq(@RequestParam String searchType, @RequestParam

// 카테고리 - 전체 검색(페이지화o)
@GetMapping("/search/category")
public Page<Post> searchQnaOrFaqByCategory(@RequestParam String searchType, @RequestParam String category,
@RequestParam String searchWord,
@RequestParam(value = "page", defaultValue = "1", required = false) int page) {
public Page<Post> searchQnaOrFaqByCategory(@RequestParam(name = "searchType") String searchType, @RequestParam(name = "category") String category,
@RequestParam(name = "searchWord") String searchWord,
@RequestParam(name = "page", defaultValue = "1", required = false) int page) {
return qnaService.searchQnaOrFaqByCategory(searchType, category, searchWord, page);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,50 +65,50 @@ public Reply createStudyPostReply(@RequestBody Map<String, Object> requestPayloa

// 댓글 수정 (Post, Study 공통)
@PostMapping("/{commentId}")
public Reply updateReply(@PathVariable Long commentId, @RequestBody Map<String, String> requestMap, Authentication authentication) {
public Reply updateReply(@PathVariable(name = "commentId") Long commentId, @RequestBody Map<String, String> requestMap, Authentication authentication) {
String replyContent = requestMap.get("replyContent");
return replyService.updateReply(commentId, replyContent, authentication);
}

// 댓글 삭제 (Post, Study 공통)
@DeleteMapping("/{commentId}")
public void deleteReply(@PathVariable Long commentId, Authentication authentication) {
public void deleteReply(@PathVariable(name = "commentId") Long commentId, Authentication authentication) {
replyService.deleteReply(commentId, authentication);
}

// 댓글 조회
@GetMapping("/{id}")
public Reply getReply(@PathVariable Long id){
public Reply getReply(@PathVariable(name = "id") Long id){
return replyService.getReply(id);
}

// 댓글 전체 조회 (최신순, 페이징)
@GetMapping()
public Page<Reply> findAllReplies(@RequestParam("page") int page) {
public Page<Reply> findAllReplies(@RequestParam(name = "page") int page) {
return replyService.findAllReplies(page);
}

// post 게시글 아이디 별 댓글 조회 (생성일 순)
@GetMapping("/post/{targetId}")
public List<Reply> findAllRepliesByPostId(@PathVariable Long targetId) {
public List<Reply> findAllRepliesByPostId(@PathVariable(name = "targetId") Long targetId) {
return replyService.findAllRepliesByPostIdOrderByCreatedAtAsc(targetId);
}

// study 게시글 아이디 별 댓글 조회 (생성일 순)
@GetMapping("/study/{targetId}")
public List<Reply> findAllRepliesByStudyId(@PathVariable Long targetId) {
public List<Reply> findAllRepliesByStudyId(@PathVariable(name = "targetId") Long targetId) {
return replyService.findAllByStudyIdAndStudyPostIdIsNullOrderByCreatedAtAsc(targetId);
}

// studyPost 게시글 아이디 별 댓글 조회 (생성일 순)
@GetMapping("/studypost/{targetId}")
public List<Reply> findAllRepliesByStudyPostId(@PathVariable Long targetId) {
public List<Reply> findAllRepliesByStudyPostId(@PathVariable(name = "targetId") Long targetId) {
return replyService.findAllRepliesByStudyPostIdOrderByCreatedAtAsc(targetId);
}

// 댓글 작성하려는 게시글의 타입 조회
@GetMapping("/type/{targetId}")
public PostType findPostTypeById(@PathVariable Long targetId) {
public PostType findPostTypeById(@PathVariable(name = "targetId") Long targetId) {
return replyService.findPostTypeById(targetId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public ReportDetail createReplyReport(@RequestBody Map<String, Object> requestPa

// 특정 report의 신고 횟수 조회
@GetMapping("/report-count/{reportId}")
public Long getReportCounts(@PathVariable Long reportId, Authentication authentication) {
public Long getReportCounts(@PathVariable(name = "reportId") Long reportId, Authentication authentication) {
return reportService.getReportCountForReport(reportId);
}

Expand All @@ -118,19 +118,19 @@ public List<Report> getReports(Authentication authentication) {

// 특정 report의 신고 사유 조회
@GetMapping("/reason/{reportId}")
public Map<String, Integer> getReportReasons(@PathVariable Long reportId, Authentication authentication) {
public Map<String, Integer> getReportReasons(@PathVariable(name = "reportId") Long reportId, Authentication authentication) {
return reportService.getReportReasons(reportId, authentication);
}

// 신고 반려
@DeleteMapping("/{reportId}")
public void rejectReport(@PathVariable Long reportId, Authentication authentication) {
public void rejectReport(@PathVariable(name = "reportId") Long reportId, Authentication authentication) {
reportService.rejectReport(reportId, authentication);
}

// 신고 승인
@PostMapping("/accept/{reportId}")
public void acceptReport(@PathVariable Long reportId, Authentication authentication) {
public void acceptReport(@PathVariable(name = "reportId") Long reportId, Authentication authentication) {
reportService.acceptReport(reportId, authentication);
}

Expand All @@ -142,7 +142,7 @@ public List<Member> getMemberReports(Authentication authentication) {

@PostMapping("/members/{memberId}")
// 강제 탈퇴
public ResponseEntity<String> forceDeleteMember(@PathVariable String memberId, Authentication authentication) {
public ResponseEntity<String> forceDeleteMember(@PathVariable(name = "memberId") String memberId, Authentication authentication) {
// reportService.forceDeleteMember(memberId, authentication);
return memberService.deleteMember(memberId, null, authentication);
}
Expand Down
Loading

0 comments on commit 19380c7

Please sign in to comment.