Skip to content

Commit

Permalink
Merge pull request #72 from pyro-yolog/fix/#71-delete-member
Browse files Browse the repository at this point in the history
Fix/#71 회원 탈퇴 시 정상적으로 멤버 삭제가 안되는 문제 해결
  • Loading branch information
yeonjy authored Aug 22, 2024
2 parents eb3c5f9 + 657edbe commit 12c65cd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ public interface AuthApi {
)
}
)
void withdrawMember();
String withdrawMember();
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public boolean signUp(@RequestBody SignUpRequest request) {
@ResponseStatus(HttpStatus.NO_CONTENT)
@DeleteMapping("/withdrawal")
@Override
public void withdrawMember() {
public String withdrawMember() {
authService.withdrawMember();
return "redirect:https://yolog.store";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.ColumnDefault;

import java.util.List;

@Getter
@Entity
Expand All @@ -27,6 +28,9 @@ public class Inquiry extends BaseTimeEntity {
@JoinColumn(name = "member_id")
private Member member;

@OneToMany(mappedBy = "inquiry", cascade = CascadeType.ALL)
private List<InquiryImage> inquiryImages;

@Builder
public Inquiry(String title, String content, Member member) {
this.title = title;
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/com/pyro/yolog/domain/member/entity/Member.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package com.pyro.yolog.domain.member.entity;

import com.pyro.yolog.domain.inquiry.entity.Inquiry;
import com.pyro.yolog.domain.member.dto.request.SignUpRequest;
import com.pyro.yolog.domain.trip.entity.Trip;
import com.pyro.yolog.global.config.BaseTimeEntity;
import jakarta.persistence.*;
import lombok.*;

import java.util.List;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
Expand All @@ -15,7 +19,7 @@ public class Member extends BaseTimeEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private String oauthId; //로그인한 소셜 타입의 식별자 값
private String oauthId;
private String nickname;
private String email;
private String password;
Expand All @@ -30,6 +34,12 @@ public class Member extends BaseTimeEntity {
@Enumerated(EnumType.STRING)
private Status status;

@OneToMany(mappedBy = "member", cascade = CascadeType.ALL)
private List<Inquiry> inquiries;

@OneToMany(mappedBy = "member", cascade = CascadeType.ALL)
private List<Trip> trips;

public void signUp(SignUpRequest dto) {
this.nickname = dto.getNickname();
this.role = Role.USER;
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/pyro/yolog/domain/trip/entity/Trip.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.pyro.yolog.domain.trip.entity;

import com.pyro.yolog.domain.diary.entity.Diary;
import com.pyro.yolog.domain.inquiry.entity.Inquiry;
import com.pyro.yolog.domain.member.entity.Member;
import com.pyro.yolog.domain.trip.dto.request.TripRequest;
import com.pyro.yolog.global.config.BaseTimeEntity;
Expand All @@ -11,6 +13,7 @@
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.util.List;

@Getter
@Entity
Expand Down Expand Up @@ -43,6 +46,9 @@ public class Trip extends BaseTimeEntity {
@JoinColumn(name = "member_id")
private Member member;

@OneToMany(mappedBy = "trip", cascade = CascadeType.ALL)
private List<Diary> diaries;

@Builder
public Trip(String name, String destination, String coverImageUrl, CoverColor coverColor, SpineColor spineColor, LocalDate startDate, LocalDate finishDate, Member member) {
this.name = name;
Expand Down

0 comments on commit 12c65cd

Please sign in to comment.