-
Notifications
You must be signed in to change notification settings - Fork 2
[BE] SISC1 [FIX] controller annotation 수정 #63
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
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ef30322
SISC1-179: TestSecurityConfig 작성
ochanhyeok 1a4ec15
AttendanceControllerTest코드 작성, TestSecurityConfig 수정
ochanhyeok 979fb32
Merge branch 'main' into SISC1-179-BE-AttendanceControllerTest-코드-작성
ochanhyeok 6b3be8e
수정: AttendanceController 및 AttendanceSessionController 코드 품질 개선. 수정
ochanhyeok 501ed60
Merge branch 'main' into SISC1-179-BE-AttendanceControllerTest-코드-작성
ochanhyeok e7766de
test: AttendanceSessionController 테스트 코드 작성
ochanhyeok 0fa7327
[BE] SISC1-179 [TEST] 코드 리뷰 피드백 반영, 테스트 메서드명 및 검증 로직 개선
ochanhyeok 0ccc9a0
[BE] SISC1-179 [TEST] 코드 리뷰 피드백 반영
ochanhyeok e260fd0
Merge branch 'main' of https://github.com/SISC-IT/sisc-web into SISC1…
ochanhyeok 42aabdd
fix: Change @Controller to @RestController for Swagger
ochanhyeok 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
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
30 changes: 30 additions & 0 deletions
30
backend/src/main/java/org/sejongisc/backend/user/dto/SignupRequest.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,30 @@ | ||
| package org.sejongisc.backend.user.dto; | ||
|
|
||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import jakarta.validation.constraints.Pattern; | ||
| import lombok.*; | ||
| import org.sejongisc.backend.user.entity.Role; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| @Builder | ||
| public class SignupRequest { | ||
|
|
||
| @NotBlank(message = "이름은 필수입니다.") | ||
| private String name; | ||
|
|
||
| private String email; | ||
|
|
||
| @NotBlank(message = "비밀번호는 필수입니다.") | ||
| private String password; | ||
|
|
||
| @NotNull(message = "역할은 필수입니다.") | ||
| private Role role; | ||
|
|
||
| @NotBlank(message = "전화번호는 필수입니다.") | ||
| @Pattern(regexp = "^[0-9]{10,11}$") | ||
| private String phoneNumber; | ||
| } |
43 changes: 43 additions & 0 deletions
43
backend/src/main/java/org/sejongisc/backend/user/dto/SignupResponse.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,43 @@ | ||
| package org.sejongisc.backend.user.dto; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||
| import lombok.Getter; | ||
| import org.sejongisc.backend.user.entity.Role; | ||
| import org.sejongisc.backend.user.entity.User; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.UUID; | ||
|
|
||
| @Getter | ||
| public class SignupResponse { | ||
| private final UUID userId; | ||
| private final String name; | ||
| private final String email; | ||
| private final Role role; | ||
|
|
||
| @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "Asia/Seoul") | ||
| private final LocalDateTime createdAt; | ||
|
|
||
| @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "Asia/Seoul") | ||
| private final LocalDateTime updatedAt; | ||
|
|
||
| private SignupResponse(UUID userId, String name, String email, Role role, LocalDateTime createdAt, LocalDateTime updatedAt) { | ||
| this.userId=userId; | ||
| this.name=name; | ||
| this.email=email; | ||
| this.role=role; | ||
| this.createdAt = createdAt; | ||
| this.updatedAt = updatedAt; | ||
| } | ||
|
|
||
| public static SignupResponse from(User user) { | ||
| return new SignupResponse( | ||
| user.getUserId(), | ||
| user.getName(), | ||
| user.getEmail(), | ||
| user.getRole(), | ||
| user.getCreatedDate(), | ||
| user.getUpdatedDate() | ||
| ); | ||
| } | ||
| } |
5 changes: 5 additions & 0 deletions
5
backend/src/main/java/org/sejongisc/backend/user/entity/AuthProvider.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,5 @@ | ||
| package org.sejongisc.backend.user.entity; | ||
|
|
||
| public enum AuthProvider { | ||
| GOOGLE, GITHUB, KAKAO | ||
| } |
34 changes: 34 additions & 0 deletions
34
backend/src/main/java/org/sejongisc/backend/user/entity/UserOauthAccount.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,34 @@ | ||
| package org.sejongisc.backend.user.entity; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.*; | ||
| import org.hibernate.annotations.UuidGenerator; | ||
| import org.sejongisc.backend.common.entity.postgres.BasePostgresEntity; | ||
|
|
||
| import java.util.UUID; | ||
|
|
||
| @Entity | ||
| @Table(name = "user_oauth_account") | ||
| @Getter | ||
| @Setter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| @Builder | ||
| public class UserOauthAccount extends BasePostgresEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.UUID) | ||
| @Column(name = "user_oauth_account_id", columnDefinition = "uuid") | ||
| private UUID userOauthAccountId; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY, optional = false) | ||
| @JoinColumn(name = "user_id", nullable = false, columnDefinition = "uuid") | ||
| private User user; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(nullable = false) | ||
| private AuthProvider provider; | ||
|
|
||
| @Column(name = "provider_uid", nullable = false) | ||
| private String providerUid; | ||
| } | ||
15 changes: 15 additions & 0 deletions
15
backend/src/test/java/org/sejongisc/backend/BackendApplicationTests.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,15 @@ | ||
| package org.sejongisc.backend; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
| import org.springframework.boot.test.context.SpringBootTest; | ||
| import org.springframework.test.context.ActiveProfiles; | ||
|
|
||
| @SpringBootTest | ||
| @ActiveProfiles("test") | ||
| class BackendApplicationTests { | ||
|
|
||
| @Test | ||
| void contextLoads() { | ||
| } | ||
|
|
||
| } |
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
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
중복 엔티티 클래스가 존재합니다 - JPA 매핑 충돌 발생 위험
동일한 테이블(
user_oauth_account)에 대한 엔티티 클래스가 이미backend/src/main/java/org/sejongisc/backend/auth/entity/UserOauthAccount.java에 존재합니다.두 엔티티의 주요 차이점:
@UniqueConstraint(columnNames = {"provider", "provider_uid"})가 있지만 새 엔티티에는 없습니다user.entityvsauth.entity이로 인한 문제:
UserServiceImpl의oauthAccountRepository는auth.entity.UserOauthAccount를 참조하고 있어 불일치가 발생합니다다음 스크립트로 중복을 확인하세요:
두 엔티티 중 하나를 제거하거나, 용도가 다르다면 테이블 이름을 변경해야 합니다.
🏁 Script executed:
Length of output: 5862
Now let me verify the specific details by checking the repository and entity usages:Based on my verification using the provided script output and web search findings, I can now generate the rewritten review comment:
중복 엔티티 클래스 제거 필요 - 동일 테이블에 매핑된 두 개의 JPA 엔티티 존재
동일한 테이블에 두 개의 엔티티를 매핑하는 것은 좋지 않은 설계 관행입니다. 현재
user_oauth_account테이블에 대해 두 엔티티가 존재합니다:backend/src/main/java/org/sejongisc/backend/user/entity/UserOauthAccount.javabackend/src/main/java/org/sejongisc/backend/auth/entity/UserOauthAccount.java주요 문제:
auth.entity버전에는@UniqueConstraint(columnNames = {"provider", "provider_uid"})가 있지만, 새로운user.entity버전에는 없습니다UserOauthAccountRepository는auth.entity.UserOauthAccount를 참조하고 있어,user.entity버전과의 불일치가 발생합니다해결 방안:
user.entity.UserOauthAccount클래스를 삭제하고, 기존auth.entity.UserOauthAccount만 사용하거나🤖 Prompt for AI Agents