-
Notifications
You must be signed in to change notification settings - Fork 6
[Feat] 전략 등록 MSW 및 기능 구현 #122
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
Conversation
리뷰어 가이드 by Sourcery이 PR은 API 모킹을 위한 MSW(Mock Service Worker)와 폼 상태 관리를 위한 Zustand를 사용하여 전략 등록 기능을 구현합니다. 구현에는 등록 폼 데이터를 가져오고 새로운 전략을 제출하기 위한 API 엔드포인트, 폼 기능을 지원하기 위한 커스텀 훅 및 유틸리티가 포함됩니다. 전략 등록 API 상호작용을 위한 시퀀스 다이어그램sequenceDiagram
actor User
participant UI
participant API
participant MSW
User->>UI: 전략 등록 폼 작성
UI->>API: GET /api/strategies/registration-form
API->>MSW: 전략 옵션이 포함된 모킹된 응답
MSW-->>API: 전략 옵션 반환
API-->>UI: 전략 옵션 제공
User->>UI: 전략 등록 폼 제출
UI->>API: POST /api/strategies with form data
API->>MSW: 전략 제출을 위한 모킹된 응답
MSW-->>API: 제출 성공 반환
API-->>UI: 전략 등록 성공 확인
전략 관련 타입에 대한 업데이트된 클래스 다이어그램classDiagram
class TradingType {
+number tradingTypeId
+string tradingTypeName
+string tradingTypeIcon
}
class InvestmentAssetClass {
+number investmentAssetClassesId
+string investmentAssetClassesName
+string investmentAssetClassesIcon
}
class TradingCycleClass {
+number tradingCycleId
+string tradingCycleName
+string tradingTypeIcon
}
class StrategyRequestBody {
+string strategyTitle
+number tradingTypeId
+number tradingCycleId
+string minInvestmentAmount
+string strategyOverview
+string isPosted
+number[] investmentAssetClassesIdList
}
class StrategyFormState {
+string strategy
+string text
+string operation
+string cycle
+string fund
+string publicStatus
+string[] selectedProducts
+void setField(field, value)
+void checkProduct(productId)
+void clearForm()
}
note for StrategyFormState "Zustand를 사용하여 상태 관리"
파일 수준 변경 사항
연결된 이슈에 대한 평가
연결될 수 있는 이슈
팁 및 명령어Sourcery와 상호작용
경험 맞춤화대시보드에 접속하여:
도움 받기Original review guide in EnglishReviewer's Guide by SourceryThis PR implements the strategy registration functionality using MSW (Mock Service Worker) for API mocking and Zustand for form state management. The implementation includes API endpoints for fetching registration form data and submitting new strategies, along with custom hooks and utilities to support the form functionality. Sequence diagram for strategy registration API interactionssequenceDiagram
actor User
participant UI
participant API
participant MSW
User->>UI: Fill strategy registration form
UI->>API: GET /api/strategies/registration-form
API->>MSW: Mocked response with strategy options
MSW-->>API: Return strategy options
API-->>UI: Provide strategy options
User->>UI: Submit strategy registration form
UI->>API: POST /api/strategies with form data
API->>MSW: Mocked response for strategy submission
MSW-->>API: Return submission success
API-->>UI: Confirm strategy registration success
Updated class diagram for strategy-related typesclassDiagram
class TradingType {
+number tradingTypeId
+string tradingTypeName
+string tradingTypeIcon
}
class InvestmentAssetClass {
+number investmentAssetClassesId
+string investmentAssetClassesName
+string investmentAssetClassesIcon
}
class TradingCycleClass {
+number tradingCycleId
+string tradingCycleName
+string tradingTypeIcon
}
class StrategyRequestBody {
+string strategyTitle
+number tradingTypeId
+number tradingCycleId
+string minInvestmentAmount
+string strategyOverview
+string isPosted
+number[] investmentAssetClassesIdList
}
class StrategyFormState {
+string strategy
+string text
+string operation
+string cycle
+string fund
+string publicStatus
+string[] selectedProducts
+void setField(field, value)
+void checkProduct(productId)
+void clearForm()
}
note for StrategyFormState "Uses Zustand for state management"
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
🚀 Deployed on https://6739edf101947adf3f2d2102--sysmetic.netlify.app |
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.
안녕하세요 @ssuminii - 변경 사항을 검토했습니다. 다음은 피드백입니다:
전반적인 의견:
- console.log 문을 제거하고 코드베이스 전반에 걸쳐 오류 처리를 표준화하는 것을 고려하세요. 프로덕션 코드는 console.log/console.error 대신 적절한 오류 추적/로깅을 사용해야 합니다.
검토 중에 살펴본 내용입니다
- 🟡 일반 문제: 2개의 문제 발견
- 🟢 보안: 모두 양호
- 🟢 테스트: 모두 양호
- 🟢 복잡성: 모두 양호
- 🟢 문서화: 모두 양호
더 유용하게 도와주세요! 각 댓글에 👍 또는 👎를 클릭해 주시면 피드백을 사용하여 리뷰를 개선하겠습니다.
Original comment in English
Hey @ssuminii - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider removing console.log statements and standardizing error handling across the codebase. Production code should use proper error tracking/logging instead of console.log/console.error.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| }); | ||
| return res.data; | ||
| } catch (error) { | ||
| console.error('failed to fetch strategy registration data', error); |
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.
issue: fetchStrategyRegistration에서 오류 처리가 개선되어야 합니다
단순히 로그를 기록하고 암시적으로 undefined를 반환하는 대신, 이 함수는 오류를 던져 호출자가 적절한 오류 처리를 할 수 있도록 해야 합니다.
Original comment in English
issue: Error handling needs improvement in fetchStrategyRegistration
Instead of just logging and implicitly returning undefined, this function should throw the error to allow proper error handling by the caller.
| prev.includes(product) ? prev.filter((item) => item !== product) : [...prev, product] | ||
| ); | ||
| const handleFileSelect = (selectedFile: File) => { | ||
| console.log(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.
issue: 파일 업로드 처리가 불완전합니다
파일 업로드 로직이 이전 파일 값을 로그로 기록하고 파일이 전략 제출 페이로드에 포함되지 않습니다. 파일 업로드가 요구 사항이라면 이를 적절히 처리해야 합니다.
Original comment in English
issue: File upload handling is incomplete
The file upload logic logs the old file value and the file isn't included in the strategy submission payload. This should be properly handled if file upload is a requirement.
|
🚀 Deployed on https://6739ef89a56ce508f0ec93c1--sysmetic.netlify.app |
|
🚀 Deployed on https://6739f88bd624eff02c3c6fbf--sysmetic.netlify.app |
clara-shin
left a comment
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.
승인! 고생하셨습니다
jizerozz
left a comment
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.
승인... await 추가 갬사..합니다
🚀 풀 리퀘스트 제안
closes #43
📋 작업 내용
🔧 변경 사항
주요 변경 사항을 요약해 주세요.
📸 스크린샷 (선택 사항)
📄 기타
추가적으로 전달하고 싶은 내용이나 특별한 요구 사항이 있으면 작성해 주세요.
Sourcery에 의한 요약
MSW를 사용하여 전략 등록 및 검색 기능을 구현하고, 이를 API와 통합하며, Zustand로 폼 상태를 관리합니다. 옵션 데이터 가져오기를 위한 커스텀 훅을 사용하여 전략 생성 폼을 리팩토링합니다.
새로운 기능:
개선 사항:
Original summary in English
Summary by Sourcery
Implement strategy registration and retrieval functionalities using MSW, integrate them with the API, and manage form state with Zustand. Refactor the strategy creation form to utilize centralized state management and custom hooks for fetching options data.
New Features:
Enhancements: