generated from Loopers-dev-lab/loop-pack-be-l2-vol2-java
-
Notifications
You must be signed in to change notification settings - Fork 44
[volume-1] 회원가입, 내 정보 조회, 비밀번호 수정 구현 #19
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
Open
move-wook
wants to merge
5
commits into
Loopers-dev-lab:move-wook
Choose a base branch
from
move-wook:round1
base: move-wook
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
995173d
2026-02-02 예제소스 삭제
move-wook de6703f
test: 회원가입, 내정보조회, 비밀번호수정 테스트 코드 추가
move-wook 976b2c0
feat : 회원가입, 내정보조회, 비밀번호수정 기능 개발
move-wook 812c9dc
test : 코드레빗리뷰 birthData null 테스트 추가
move-wook 0c2ec4b
feta : 코드레빗리뷰 birthData null 체크 추가, zoneTime수정
move-wook 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 hidden or 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
17 changes: 0 additions & 17 deletions
17
apps/commerce-api/src/main/java/com/loopers/application/example/ExampleFacade.java
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
apps/commerce-api/src/main/java/com/loopers/application/example/ExampleInfo.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
apps/commerce-api/src/main/java/com/loopers/application/user/UserFacade.java
This file contains hidden or 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,29 @@ | ||
| package com.loopers.application.user; | ||
|
|
||
| import com.loopers.domain.user.User; | ||
| import com.loopers.domain.user.UserService; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
| @Component | ||
| @RequiredArgsConstructor | ||
| public class UserFacade { | ||
|
|
||
| private final UserService userService; | ||
|
|
||
| public UserInfo register(String loginId, String password, String name, LocalDate birthDate, String email) { | ||
| User user = userService.register(loginId, password, name, birthDate, email); | ||
| return UserInfo.from(user); | ||
| } | ||
|
|
||
| public UserInfo getUserInfo(String loginId, String password) { | ||
| User user = userService.getUserInfo(loginId, password); | ||
| return UserInfo.from(user); | ||
| } | ||
|
|
||
| public void updatePassword(String loginId, String currentPassword, String newPassword, LocalDate birthDate) { | ||
| userService.updatePassword(loginId, currentPassword, newPassword, birthDate); | ||
| } | ||
| } |
33 changes: 33 additions & 0 deletions
33
apps/commerce-api/src/main/java/com/loopers/application/user/UserInfo.java
This file contains hidden or 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,33 @@ | ||
| package com.loopers.application.user; | ||
|
|
||
| import com.loopers.domain.user.User; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
| public record UserInfo( | ||
| Long id, | ||
| String loginId, | ||
| String name, | ||
| LocalDate birthDate, | ||
| String email | ||
| ) { | ||
| public static UserInfo from(User user) { | ||
| return new UserInfo( | ||
| user.getId(), | ||
| user.getLoginId(), | ||
| user.getName(), | ||
| user.getBirthDate(), | ||
| user.getEmail() | ||
| ); | ||
| } | ||
|
|
||
| public String getMaskedName() { | ||
| if (name == null || name.isEmpty()) { | ||
| return name; | ||
| } | ||
| if (name.length() == 1) { | ||
| return "*"; | ||
| } | ||
| return name.substring(0, name.length() - 1) + "*"; | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
apps/commerce-api/src/main/java/com/loopers/config/SecurityConfig.java
This file contains hidden or 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,14 @@ | ||
| package com.loopers.config; | ||
|
|
||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
|
|
||
| @Configuration | ||
| public class SecurityConfig { | ||
|
|
||
| @Bean | ||
| public BCryptPasswordEncoder passwordEncoder() { | ||
| return new BCryptPasswordEncoder(); | ||
| } | ||
| } |
44 changes: 0 additions & 44 deletions
44
apps/commerce-api/src/main/java/com/loopers/domain/example/ExampleModel.java
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
apps/commerce-api/src/main/java/com/loopers/domain/example/ExampleRepository.java
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
apps/commerce-api/src/main/java/com/loopers/domain/example/ExampleService.java
This file was deleted.
Oops, something went wrong.
78 changes: 78 additions & 0 deletions
78
apps/commerce-api/src/main/java/com/loopers/domain/user/User.java
This file contains hidden or 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,78 @@ | ||
| package com.loopers.domain.user; | ||
|
|
||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.GeneratedValue; | ||
| import jakarta.persistence.GenerationType; | ||
| import jakarta.persistence.Id; | ||
| import jakarta.persistence.Index; | ||
| import jakarta.persistence.PrePersist; | ||
| import jakarta.persistence.PreUpdate; | ||
| import jakarta.persistence.Table; | ||
| import lombok.Getter; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.time.LocalDateTime; | ||
|
|
||
| @Entity | ||
| @Table(name = "users", indexes = { | ||
| @Index(name = "idx_login_id", columnList = "login_id"), | ||
| @Index(name = "idx_email", columnList = "email") | ||
| }) | ||
| @Getter | ||
| public class User { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "user_id") | ||
| private Long id; | ||
|
|
||
| @Column(name = "login_id", length = 50, nullable = false, unique = true) | ||
| private String loginId; | ||
|
|
||
| @Column(name = "password", length = 255, nullable = false) | ||
| private String password; | ||
|
|
||
| @Column(name = "name", length = 100, nullable = false) | ||
| private String name; | ||
|
|
||
| @Column(name = "birth_date", nullable = false) | ||
| private LocalDate birthDate; | ||
|
|
||
| @Column(name = "email", length = 255, nullable = false) | ||
| private String email; | ||
|
|
||
| @Column(name = "created_at", nullable = false, updatable = false) | ||
| private LocalDateTime createdAt; | ||
|
|
||
| @Column(name = "updated_at", nullable = false) | ||
| private LocalDateTime updatedAt; | ||
|
|
||
| protected User() {} | ||
|
|
||
| public static User create(String loginId, String password, String name, LocalDate birthDate, String email) { | ||
| User user = new User(); | ||
| user.loginId = loginId; | ||
| user.password = password; | ||
| user.name = name; | ||
| user.birthDate = birthDate; | ||
| user.email = email; | ||
| return user; | ||
| } | ||
|
|
||
| @PrePersist | ||
| private void prePersist() { | ||
| LocalDateTime now = LocalDateTime.now(); | ||
| this.createdAt = now; | ||
| this.updatedAt = now; | ||
| } | ||
|
|
||
| @PreUpdate | ||
| private void preUpdate() { | ||
| this.updatedAt = LocalDateTime.now(); | ||
| } | ||
|
|
||
| public void updatePassword(String newPassword) { | ||
| this.password = newPassword; | ||
| } | ||
| } | ||
9 changes: 9 additions & 0 deletions
9
apps/commerce-api/src/main/java/com/loopers/domain/user/UserRepository.java
This file contains hidden or 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 com.loopers.domain.user; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| public interface UserRepository { | ||
| User save(User user); | ||
| Optional<User> findByLoginId(String loginId); | ||
| boolean existsByLoginId(String loginId); | ||
| } |
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.
🧩 Analysis chain
🏁 Script executed:
Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java
Length of output: 2752
🏁 Script executed:
Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java
Length of output: 318
🏁 Script executed:
Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java
Length of output: 67
🏁 Script executed:
Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java
Length of output: 299
🏁 Script executed:
Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java
Length of output: 67
🏁 Script executed:
Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java
Length of output: 67
🏁 Script executed:
Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java
Length of output: 366
🏁 Script executed:
Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java
Length of output: 5026
🏁 Script executed:
Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java
Length of output: 67
JPA 엔티티 식별자 기반 equals/hashCode 구현 추가 권장한다.
User 엔티티는 현재 equals/hashCode가 구현되지 않았다. 현재 코드에서는 개별 엔티티 조회/저장 패턴만 사용하므로 즉각적인 운영 문제는 없으나, 향후 다음과 같은 상황에서 예상치 못한 동작이 발생할 수 있다:
데이터베이스 식별자 기반으로 equals/hashCode를 구현하면 장기적 운영 안정성을 확보할 수 있다:
추가로 저장되지 않은 엔티티(id=null)와 저장된 엔티티 간 동치성 비교를 검증하는 단위 테스트를 작성한다.
🤖 Prompt for AI Agents