Skip to content
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
Binary file modified .gradle/8.4/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/8.4/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/8.4/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/8.4/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/8.4/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/file-system.probe
Binary file not shown.
1 change: 0 additions & 1 deletion .idea/dataSources.local.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 49 additions & 32 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ public BaseResponse<List<JJimResponseDto>> getJJimList(@AuthenticationPrincipal
List<JJimResponseDto> jjimList = jjimService.getJJimList(customOAuth2User.getUserId());
return BaseResponse.onSuccess(SuccessStatus._OK, jjimList);
}

@PatchMapping
public BaseResponse<String> cancelJJim(@RequestBody JJimRequestDto requestDto, @AuthenticationPrincipal CustomOAuth2User customOAuth2User){
jjimService.cancelJJim(requestDto.getPodId(), customOAuth2User.getUserId());
return BaseResponse.onSuccess(SuccessStatus._OK, "successfully canceled jjim");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.podmate.domain.jjim.domain.repository.JJimRepository;
import com.podmate.domain.jjim.dto.JJimResponseDto;
import com.podmate.domain.jjim.exception.DuplicateJJimException;
import com.podmate.domain.jjim.exception.JJimNotFoundException;
import com.podmate.domain.pod.domain.entity.Pod;
import com.podmate.domain.pod.domain.repository.PodRepository;
import com.podmate.domain.pod.exception.PodNotFoundException;
Expand Down Expand Up @@ -66,4 +67,21 @@ public List<JJimResponseDto> getJJimList(Long userId){
})
.collect(Collectors.toList());
}

public void cancelJJim(Long podId, Long userId){
User user = userRepository.findById(userId)
.orElseThrow(() -> new UserNotFoundException());

Pod pod = podRepository.findById(podId)
.orElseThrow(() -> new PodNotFoundException());

if(!podUserMappingRepository.existsByPod_IdAndUser_Id(pod.getId(), user.getId())){
throw new PodUserMappingNotFoundException();
}
if (jjimRepository.existsByUserIdAndPodId(user.getId(), pod.getId())) {
jjimRepository.deleteByUserIdAndPodId(user.getId(), pod.getId());
} else {
throw new JJimNotFoundException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
public interface JJimRepository extends JpaRepository<JJim, Long> {
List<JJim> findAllByUserId(Long userId);
boolean existsByUserIdAndPodId(Long userId, Long podId);
void deleteByUserIdAndPodId(Long userId, Long podId);
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package com.podmate.domain.jjim.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class JJimRequestDto {

private Long podId;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.podmate.domain.jjim.exception;

import com.podmate.global.common.code.status.ErrorStatus;
import com.podmate.global.exception.GeneralException;

public class JJimNotFoundException extends GeneralException {
public JJimNotFoundException() {
super(ErrorStatus.JJIM_NOT_FOUND);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public enum ErrorStatus implements BaseErrorCode {

// --- JJIM ---
DUPLICATE_JJIM(HttpStatus.CONFLICT, "JJIM_409", "이미 찜한 팟입니다."),
JJIM_NOT_FOUND(HttpStatus.NOT_FOUND, "JJIM_404", "존재하지 않는 찜입니다."),

// --- PLATFORMINFO --
PLATFORM_NOT_SUPPORTED(HttpStatus.NOT_FOUND, "PLATFORM_404", "지원하지 않는 플랫폼입니다."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo
"refreshToken", refreshToken
)
);
//gresponse.getWriter().write(body);
//response.getWriter().write(body);
String redirectUrl = UriComponentsBuilder
.fromUriString("http://localhost:5173/oauth/redirect") // ✅ 프론트 리디렉션 주소
.queryParam("status", "success")
Expand Down