-
Notifications
You must be signed in to change notification settings - Fork 0
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/user withdrawal] 마이페이지-회원탈퇴 API #67
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/everymeal/server/user/controller/dto/request/UserProfileUpdateReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package everymeal.server.user.controller.dto.request; | ||
|
||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
public record UserProfileUpdateReq( | ||
@Schema(description = "닉네임", example = "연유크림") String nickName, | ||
@Schema(description = "프로필 이미지 key", example = "user/bc90af33-bc6a-4009-bfc8-2c3efe0b16bd") | ||
String profileImageKey) {} |
22 changes: 22 additions & 0 deletions
22
src/main/java/everymeal/server/user/controller/dto/request/WithdrawalReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package everymeal.server.user.controller.dto.request; | ||
|
||
|
||
import everymeal.server.user.entity.WithdrawalReason; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotBlank; | ||
|
||
public record WithdrawalReq( | ||
@NotBlank | ||
@Schema( | ||
description = "탈퇴 사유를 입력해주세요.", | ||
example = "NOT_USE_USUALLY", | ||
allowableValues = { | ||
"NOT_USE_USUALLY", | ||
"INCONVENIENT_IN_TERMS_OF_USABILITY", | ||
"ERRORS_OCCUR_FREQUENTLY", | ||
"MY_SCHOOL_HAS_CHANGED", | ||
"ETC" | ||
}) | ||
WithdrawalReason withdrawalReason, | ||
@Schema(description = "사유가 '기타'일 경우, 추가 이유 입력해주세요.", example = "다른 서비스를 사용하게 되었다.") | ||
String etcReason) {} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/everymeal/server/user/entity/Withdrawal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package everymeal.server.user.entity; | ||
|
||
|
||
import everymeal.server.global.entity.BaseEntity; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.MapsId; | ||
import jakarta.persistence.OneToOne; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Withdrawal extends BaseEntity { | ||
@Id private Long userIdx; | ||
|
||
@Column(nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private WithdrawalReason withdrawalReason; | ||
|
||
@Column(nullable = true, columnDefinition = "TEXT") | ||
private String etcReason; | ||
|
||
@MapsId | ||
@OneToOne | ||
@JoinColumn(name = "user_idx", referencedColumnName = "idx") | ||
private User user; | ||
|
||
@Builder | ||
public Withdrawal(WithdrawalReason withdrawalReason, String etcReason, User user) { | ||
this.withdrawalReason = withdrawalReason; | ||
this.etcReason = etcReason; | ||
this.user = user; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/everymeal/server/user/entity/WithdrawalReason.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package everymeal.server.user.entity; | ||
|
||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum WithdrawalReason { | ||
NOT_USE_USUALLY("앱을 잘 쓰지 않아요"), | ||
INCONVENIENT_IN_TERMS_OF_USABILITY("사용성이 불편해요"), | ||
ERRORS_OCCUR_FREQUENTLY("오류가 자주 발생해요"), | ||
MY_SCHOOL_HAS_CHANGED("학교가 바뀌었어요"), | ||
ETC("기타"); | ||
Comment on lines
+10
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enum으로 탈퇴사유 정리해두는 것 좋은 것 같습니다!! |
||
|
||
public final String MESSAGE; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/everymeal/server/user/repository/WithdrawalRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package everymeal.server.user.repository; | ||
|
||
|
||
import everymeal.server.user.entity.Withdrawal; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface WithdrawalRepository extends JpaRepository<Withdrawal, Long> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
만약 기타를 선택한 경우에 대해서도 남겨서 서비스 운영도 생각하는 것이 너무 좋은 방향 같아요!