-
Notifications
You must be signed in to change notification settings - Fork 2
hotfix: 학과코드 없는 곳 대응 #103
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
The head ref may contain hidden characters: "hotfix/\uD559\uACFC\uCF54\uB4DC-\uC5C6\uB294-\uACFC-\uB300\uC751"
hotfix: 학과코드 없는 곳 대응 #103
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough이 PR은 프론트엔드와 백엔드 코드의 안정성을 높이기 위한 변경 사항을 포함합니다. 프론트엔드에서는 Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant UseCase as InitializePortalConnectionUseCase
participant Dept as Department Service
participant Major as Major Service
Client->>UseCase: 포털 연결 초기화 요청
UseCase->>Dept: 부서 데이터 요청
Dept-->>UseCase: 부서 데이터 반환
UseCase->>UseCase: 전공 코드 존재 여부 확인
alt 전공 정보가 있는 경우
UseCase->>Major: 전공 데이터 요청
Major-->>UseCase: 전공 데이터 반환
else 전공 정보 없음
UseCase->>UseCase: 전공 데이터를 null로 설정
end
UseCase->>Client: 학생 정보 반환
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
app/(main)/main/page.tsx
(2 hunks)server/application/student/usecases/InitializePortalConnectionUseCase.ts
(5 hunks)server/domain/student/repository/IStudentRepository.ts
(1 hunks)server/infrastructure/supabase/repository/SupabaseUserRepository.ts
(2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
app/(main)/main/page.tsx
[error] 27-27: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.
(lint/style/useNumberNamespace)
server/application/student/usecases/InitializePortalConnectionUseCase.ts
[error] 60-60: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🔇 Additional comments (9)
server/domain/student/repository/IStudentRepository.ts (1)
25-25
: 타입 확장을 통한 예외 상황 대응인터페이스에서
majorId
타입을number | null
로 변경함으로써 학과 코드가 없는 경우에도 대응할 수 있게 되었습니다. 이 변경은 전공 정보가 없는 학생 데이터를 처리할 때 발생할 수 있는 런타임 오류를 방지합니다.server/infrastructure/supabase/repository/SupabaseUserRepository.ts (2)
14-16
: 가독성이 향상된 코드 구조select 문을 여러 줄로 분리하여 가독성이 향상되었습니다. 기능적 변화는 없지만 코드 유지 관리 측면에서 좋은 변경입니다.
41-41
: 에러 로깅 추가로 디버깅 개선에러 발생 시 로그를 남기는 코드를 추가하여 디버깅이 용이해졌습니다. 이는 포털 연동 초기화 과정에서 오류가 발생했을 때 원인 파악에 도움이 됩니다.
app/(main)/main/page.tsx (1)
55-55
: 학과명 대체 로직 일관성 유지
majorName
이 없을 경우departmentName
으로 대체하는 조건부 로직을 추가하여handleGraduationProgress
함수의 로직과 일관성을 유지하고 있습니다. 이를 통해 누락된 데이터가 있는 상황에서도 UI가 적절히 렌더링됩니다.server/application/student/usecases/InitializePortalConnectionUseCase.ts (5)
57-69
: 단계적 데이터 조회로 오류 처리 개선기존 병렬 처리 방식에서 순차적 처리 방식으로 변경하여 학과와 전공 데이터를 조회합니다. 특히 전공 코드가 없는 경우 null로 처리하는 로직 추가로 데이터 무결성이 향상되었습니다.
🧰 Tools
🪛 Biome (1.9.4)
[error] 60-60: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
79-79
: 안전한 속성 접근으로 런타임 오류 방지옵셔널 체이닝 연산자(
?.
)를 사용하여major
객체가 null일 경우에도 안전하게getId()
메서드에 접근할 수 있도록 수정했습니다. 이로써 전공 정보가 없는 경우에도 에러 없이 실행됩니다.
143-146
: 조건 검증 로직 완화로 유연성 향상
majorId
에 대한 유효성 검사를 제거하여 전공 정보가 없는 경우에도 처리할 수 있도록 변경했습니다. 이제departmentId
만 필수로 검증하므로 전공 정보가 없는 학과의 경우에도 포털 연동이 가능합니다.
152-152
: 명시적 null 처리로 타입 안정성 확보
majorId
가 없을 경우 명시적으로 null로 설정함으로써 타입 안정성을 확보했습니다. 이는StudentInitializationDataType
인터페이스의 변경과 일치하며, 전공 정보가 없는 경우에도 일관된 데이터 구조를 유지합니다.
169-169
: 대체 정보 제공으로 사용자 경험 개선전공 정보(
major
)가 없을 경우 학과명(department.getName()
)을 대체로 사용하도록 변경했습니다. 이로써 전공 정보가 없는 학생도 일관된 정보를 제공받을 수 있어 사용자 경험이 개선됩니다.
@@ -24,7 +24,7 @@ export default function Home() { | |||
|
|||
const handleGraduationProgress = () => { | |||
router.push( | |||
`${ROUTES.GRADUATION_PROGRESS}/${parseInt(data?.profile.studentCode.slice(0, 2) ?? '0')}/${data?.profile.majorName}` | |||
`${ROUTES.GRADUATION_PROGRESS}/${parseInt(data?.profile.studentCode.slice(0, 2) ?? '0')}/${data?.profile?.majorName ? data?.profile?.majorName : (data?.profile?.departmentName ?? '')}` |
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.
🧹 Nitpick (assertive)
학과명 대체 로직 개선 및 ES2015 표준 준수
majorName
이 없을 경우 departmentName
으로 대체하는 조건부 로직을 추가하여 누락된 데이터에 대한 대응이 개선되었습니다. 하지만 parseInt
대신 ES2015 표준인 Number.parseInt
를 사용하는 것이 권장됩니다.
- `${ROUTES.GRADUATION_PROGRESS}/${parseInt(data?.profile.studentCode.slice(0, 2) ?? '0')}/${data?.profile?.majorName ? data?.profile?.majorName : (data?.profile?.departmentName ?? '')}`
+ `${ROUTES.GRADUATION_PROGRESS}/${Number.parseInt(data?.profile.studentCode.slice(0, 2) ?? '0')}/${data?.profile?.majorName ? data?.profile?.majorName : (data?.profile?.departmentName ?? '')}`
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
`${ROUTES.GRADUATION_PROGRESS}/${parseInt(data?.profile.studentCode.slice(0, 2) ?? '0')}/${data?.profile?.majorName ? data?.profile?.majorName : (data?.profile?.departmentName ?? '')}` | |
`${ROUTES.GRADUATION_PROGRESS}/${Number.parseInt(data?.profile.studentCode.slice(0, 2) ?? '0')}/${data?.profile?.majorName ? data?.profile?.majorName : (data?.profile?.departmentName ?? '')}` |
🧰 Tools
🪛 Biome (1.9.4)
[error] 27-27: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.
(lint/style/useNumberNamespace)
Summary by CodeRabbit
Bug Fixes
Refactor