Skip to content

Commit

Permalink
Merge pull request #39 from Mojacknong/feature_32/계정-삭제-api
Browse files Browse the repository at this point in the history
Feature 32/계정 삭제 api
  • Loading branch information
Ryeolee authored Nov 22, 2023
2 parents c010e44 + 9cfea35 commit 9945f0e
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: ModernFarmer CI/CD

on:
push:
branches: ["feature_29/코드-정리"]
branches: ["feature_32/계정-삭제-api"]

pull_request:
branches: ["dev"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package modernfarmer.server.farmususer.community;


import modernfarmer.server.farmususer.user.dto.response.BaseResponseDto;
import modernfarmer.server.farmususer.user.entity.BaseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(url = "http://3.38.2.59:8082", name = "community-service")
public interface CommunityServiceFeignClient {

@DeleteMapping("/api/community/posting/all-posting/{userId}")
void deleteAllPosting(@PathVariable("userId") Long userId);




}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package modernfarmer.server.farmususer.farm;


import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;

@FeignClient(url = "http://3.36.221.140:8081", name = "farm-service")
public interface FarmServiceFeignClient {

@DeleteMapping("/api/veggie/{userId}")
void deleteAllVeggies(@PathVariable("userId") Long userId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public class UserFirebaseToken extends BaseEntity{
private String token;

@NotNull
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@OnDelete(action = OnDeleteAction.CASCADE)
@ManyToOne(fetch = FetchType.LAZY, optional = false, cascade = CascadeType.REMOVE)
@JoinColumn(name = "user_id", nullable = false)
private User user;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public class UserMotivation extends BaseEntity{
private User user;

@NotNull
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@OnDelete(action = OnDeleteAction.CASCADE)
@ManyToOne(fetch = FetchType.LAZY, optional = false, cascade = CascadeType.REMOVE)
@JoinColumn(name = "motivation_id", nullable = false)
private Motivation motivation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import modernfarmer.server.farmususer.community.CommunityServiceFeignClient;
import modernfarmer.server.farmususer.farm.FarmServiceFeignClient;
import modernfarmer.server.farmususer.global.config.s3.S3Uploader;
import modernfarmer.server.farmususer.global.exception.fail.ErrorMessage;
import modernfarmer.server.farmususer.global.exception.success.SuccessMessage;
Expand Down Expand Up @@ -32,6 +34,8 @@ public class UserService {
private final UserRepository userRepository;
private final S3Uploader s3Uploader;
private final TimeCalculator timeCalculator;
private final CommunityServiceFeignClient communityServiceFeignClient;
private final FarmServiceFeignClient farmServiceFeignClient;


// public BaseResponseDto emitProfileImage(Long userId, MultipartFile multipartFile) throws IOException {
Expand Down Expand Up @@ -113,6 +117,8 @@ public BaseResponseDto<Void> signUpComlete(Long userId){
public BaseResponseDto<Void> deleteUser(Long userId){

userRepository.deleteUser(userId);
communityServiceFeignClient.deleteAllPosting(userId);
farmServiceFeignClient.deleteAllVeggies(userId);

log.info("유저 계정 삭제 완료");

Expand Down

0 comments on commit 9945f0e

Please sign in to comment.