-
Notifications
You must be signed in to change notification settings - Fork 1
Feat: #47 개인정보처리방침 개선 #48
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
Changes from 12 commits
d424832
9c58708
dca5fbd
2c3a5ef
850fe3b
8a3a3cf
5049692
c45c0c5
284e359
90ea88e
42fa876
a89f7ab
53e5b7f
7595fa4
9643f23
fd8a194
d7a53b9
ec1ae8b
99d0f4b
46b29e6
57ca2f6
3896561
fe6705a
3683bc9
c68ea56
6a5037f
bdb1d3d
dc0bc2b
97c82de
c6cdd89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,13 +18,34 @@ const isPositiveNumberText = (value: string) => { | |
| return Number.isInteger(parsedValue) && parsedValue > 0; | ||
| }; | ||
|
|
||
| export const isApplicationFormValid = (formData: BodyDiagnosisFormData) => { | ||
| export type ApplicationFormValidation = { | ||
| isValid: boolean; | ||
| errors: { | ||
| requiredAgreement: string | null; | ||
| }; | ||
| }; | ||
|
|
||
| export const validateApplicationForm = ( | ||
| formData: BodyDiagnosisFormData, | ||
| ): ApplicationFormValidation => { | ||
| const hasAllRequiredTextValues = REQUIRED_TEXT_FIELDS.every((field) => | ||
| hasTextValue(formData[field]), | ||
| ); | ||
| const hasAllRequiredAgreements = REQUIRED_AGREEMENT_FIELDS.every((field) => formData[field]); | ||
| const hasValidHeight = isPositiveNumberText(formData.height); | ||
| const hasValidWeight = isPositiveNumberText(formData.weight); | ||
|
|
||
| return hasAllRequiredTextValues && hasAllRequiredAgreements && hasValidHeight && hasValidWeight; | ||
| const requiredAgreement = hasAllRequiredAgreements | ||
| ? null | ||
| : '필수 동의 항목(개인정보 수집·이용, 서비스 이용약관)에 동의해 주세요.'; | ||
|
Comment on lines
+38
to
+40
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. 🧹 Nitpick | 🔵 Trivial 에러 메시지 중복 가능성 검토 필요 이 에러 메시지( 두 메시지가 다른 맥락에서 의도적으로 사용된다면 괜찮지만, 동일한 목적이라면 상수로 통합하여 일관성을 유지하는 것이 좋습니다. Based on learnings: "Group together constants, validations, and error handling that change together as a single unit" 🤖 Prompt for AI Agents |
||
|
|
||
| return { | ||
| isValid: hasAllRequiredTextValues && hasAllRequiredAgreements && hasValidHeight && hasValidWeight, | ||
| errors: { | ||
| requiredAgreement, | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export const isApplicationFormValid = (formData: BodyDiagnosisFormData) => | ||
| validateApplicationForm(formData).isValid; | ||
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 | 🔵 Trivial
동의 체크 항목 렌더링 중복을 구성 데이터로 묶으면 변경 누락 리스크를 줄일 수 있습니다.
현재 4개 항목이 거의 같은 마크업/핸들러를 반복하고 있어, 필드 추가·문구 개정 시 한 블록만 수정되는 회귀가 발생하기 쉽습니다. 항목 메타데이터 배열 +
map으로 묶어두면 동의 정책 변경 대응이 안전해집니다.♻️ 리팩터링 예시
Based on learnings: Applies to **/*.{tsx,ts} : Group together constants, validations, and error handling that change together as a single unit.
🤖 Prompt for AI Agents