Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/copy #96

Merged
merged 3 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo
targetUrl = "http://localhost:3000/oath-processor"; // 로컬 환경
} else if (referer != null && referer.startsWith("https://hooking.me/") && host.equals("hooking.shop")) {
targetUrl = "https://hooking.me/oath-processor"; // 실배포 환경

}
else {
// 기본적으로 로컬 개발 환경으로 설정
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,18 @@ public ResponseEntity<List<CopyRes>> searchFilterCard(HttpServletRequest httpReq


// 카피라이팅 스크랩 취소 (soft delete)
@PostMapping ("/scrap/cancel")
public ResponseEntity<String> cancelScrap(HttpServletRequest httpRequest, @RequestBody CopyReq copyReq){
@PostMapping ("/scrap/cancle")
public ResponseEntity<HttpRes<String>> cancelScrap(HttpServletRequest httpRequest, @RequestBody CopyReq copyReq){
User user = jwtTokenProvider.getUserInfoByToken(httpRequest);
Long cardId = copyReq.getCardId();
Card card = cardRepository.findCardById(cardId);
boolean is_canceled = copyService.cancelScrap(user, card);
if(is_canceled){
return ResponseEntity.status(HttpStatus.OK).body("삭제되었습니다.");
return ResponseEntity.ok(new HttpRes<>("해당 스크랩을 삭제했습니다."));
}
else{
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("스크랩 정보가 유효하지 않습니다.");
String errorMessage = "스크랩 정보가 유효하지 않습니다.";
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new HttpRes<>(HttpStatus.BAD_REQUEST.value(), errorMessage));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface ScrapRepository extends JpaRepository<Scrap, Long> {
@Override
List<Scrap> findAll();

List<Scrap> findScrapByUser(User user);
List<Scrap> findScrapByUser(User user); //여기서 최신순으로 가져오게

List<Scrap> findByCardId(Long id); // 카드 식별번호로 스크랩 객체 찾기

Expand Down