diff --git a/.gradle/8.4/executionHistory/executionHistory.bin b/.gradle/8.4/executionHistory/executionHistory.bin
index d470b34..8bc5503 100644
Binary files a/.gradle/8.4/executionHistory/executionHistory.bin and b/.gradle/8.4/executionHistory/executionHistory.bin differ
diff --git a/.gradle/8.4/executionHistory/executionHistory.lock b/.gradle/8.4/executionHistory/executionHistory.lock
index dbb9ce7..c555c2b 100644
Binary files a/.gradle/8.4/executionHistory/executionHistory.lock and b/.gradle/8.4/executionHistory/executionHistory.lock differ
diff --git a/.gradle/8.4/fileHashes/fileHashes.bin b/.gradle/8.4/fileHashes/fileHashes.bin
index f790185..3170206 100644
Binary files a/.gradle/8.4/fileHashes/fileHashes.bin and b/.gradle/8.4/fileHashes/fileHashes.bin differ
diff --git a/.gradle/8.4/fileHashes/fileHashes.lock b/.gradle/8.4/fileHashes/fileHashes.lock
index d7c728e..2556483 100644
Binary files a/.gradle/8.4/fileHashes/fileHashes.lock and b/.gradle/8.4/fileHashes/fileHashes.lock differ
diff --git a/.gradle/8.4/fileHashes/resourceHashesCache.bin b/.gradle/8.4/fileHashes/resourceHashesCache.bin
index 61ae248..b7b94e9 100644
Binary files a/.gradle/8.4/fileHashes/resourceHashesCache.bin and b/.gradle/8.4/fileHashes/resourceHashesCache.bin differ
diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock
index f54ccb6..8b8189f 100644
Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe
index b3a2cce..440e2ef 100644
Binary files a/.gradle/file-system.probe and b/.gradle/file-system.probe differ
diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml
index 360da4f..e6e0867 100644
--- a/.idea/dataSources.local.xml
+++ b/.idea/dataSources.local.xml
@@ -5,7 +5,6 @@
#@
`
- true
master_key
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a5d8b50..12a6ebd 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,23 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -58,9 +74,9 @@
-
+
@@ -97,38 +113,38 @@
- {
- "keyToString": {
- "Gradle.Build PodMate.executor": "Run",
- "Gradle.C:/Users/pwyic/desktop/PodMate/be [clean].executor": "Run",
- "Gradle.PodMate:be [build].executor": "Run",
- "RequestMappingsPanelOrder0": "0",
- "RequestMappingsPanelOrder1": "1",
- "RequestMappingsPanelWidth0": "75",
- "RequestMappingsPanelWidth1": "75",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "SHARE_PROJECT_CONFIGURATION_FILES": "true",
- "Spring Boot.PodMateApplication.executor": "Run",
- "git-widget-placeholder": "feat/#114-payment-request-notification",
- "kotlin-language-version-configured": "true",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "project.structure.last.edited": "Modules",
- "project.structure.proportion": "0.0",
- "project.structure.side.proportion": "0.0",
- "settings.editor.selected.configurable": "reference.settingsdialog.project.gradle",
- "vue.rearranger.settings.migration": "true"
+
+}]]>
@@ -244,7 +260,8 @@
-
+
+
diff --git a/be/src/main/java/com/podmate/domain/jjim/api/JJimController.java b/be/src/main/java/com/podmate/domain/jjim/api/JJimController.java
index 9458d07..92e3c8f 100644
--- a/be/src/main/java/com/podmate/domain/jjim/api/JJimController.java
+++ b/be/src/main/java/com/podmate/domain/jjim/api/JJimController.java
@@ -30,4 +30,10 @@ public BaseResponse> getJJimList(@AuthenticationPrincipal
List jjimList = jjimService.getJJimList(customOAuth2User.getUserId());
return BaseResponse.onSuccess(SuccessStatus._OK, jjimList);
}
+
+ @PatchMapping
+ public BaseResponse cancelJJim(@RequestBody JJimRequestDto requestDto, @AuthenticationPrincipal CustomOAuth2User customOAuth2User){
+ jjimService.cancelJJim(requestDto.getPodId(), customOAuth2User.getUserId());
+ return BaseResponse.onSuccess(SuccessStatus._OK, "successfully canceled jjim");
+ }
}
diff --git a/be/src/main/java/com/podmate/domain/jjim/application/JJimService.java b/be/src/main/java/com/podmate/domain/jjim/application/JJimService.java
index 05dd733..5e92879 100644
--- a/be/src/main/java/com/podmate/domain/jjim/application/JJimService.java
+++ b/be/src/main/java/com/podmate/domain/jjim/application/JJimService.java
@@ -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;
@@ -66,4 +67,21 @@ public List 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();
+ }
+ }
}
diff --git a/be/src/main/java/com/podmate/domain/jjim/domain/repository/JJimRepository.java b/be/src/main/java/com/podmate/domain/jjim/domain/repository/JJimRepository.java
index 47a530c..7534f1b 100644
--- a/be/src/main/java/com/podmate/domain/jjim/domain/repository/JJimRepository.java
+++ b/be/src/main/java/com/podmate/domain/jjim/domain/repository/JJimRepository.java
@@ -10,4 +10,5 @@
public interface JJimRepository extends JpaRepository {
List findAllByUserId(Long userId);
boolean existsByUserIdAndPodId(Long userId, Long podId);
+ void deleteByUserIdAndPodId(Long userId, Long podId);
}
diff --git a/be/src/main/java/com/podmate/domain/jjim/dto/JJimRequestDto.java b/be/src/main/java/com/podmate/domain/jjim/dto/JJimRequestDto.java
index 1d3ebdd..35f9fff 100644
--- a/be/src/main/java/com/podmate/domain/jjim/dto/JJimRequestDto.java
+++ b/be/src/main/java/com/podmate/domain/jjim/dto/JJimRequestDto.java
@@ -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;
diff --git a/be/src/main/java/com/podmate/domain/jjim/exception/JJimNotFoundException.java b/be/src/main/java/com/podmate/domain/jjim/exception/JJimNotFoundException.java
new file mode 100644
index 0000000..e83458c
--- /dev/null
+++ b/be/src/main/java/com/podmate/domain/jjim/exception/JJimNotFoundException.java
@@ -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);
+ }
+}
diff --git a/be/src/main/java/com/podmate/global/common/code/status/ErrorStatus.java b/be/src/main/java/com/podmate/global/common/code/status/ErrorStatus.java
index 2324009..bc92e4f 100644
--- a/be/src/main/java/com/podmate/global/common/code/status/ErrorStatus.java
+++ b/be/src/main/java/com/podmate/global/common/code/status/ErrorStatus.java
@@ -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", "지원하지 않는 플랫폼입니다."),
diff --git a/be/src/main/java/com/podmate/global/util/oauth2/OAuth2LoginSuccessHandler.java b/be/src/main/java/com/podmate/global/util/oauth2/OAuth2LoginSuccessHandler.java
index f15f954..0db8e01 100644
--- a/be/src/main/java/com/podmate/global/util/oauth2/OAuth2LoginSuccessHandler.java
+++ b/be/src/main/java/com/podmate/global/util/oauth2/OAuth2LoginSuccessHandler.java
@@ -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")