Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… Supabase BabyRegistrationRepositoryImpl이 SupabaseClient를 직접 의존하지 않도록 BabyRegistrationService 인터페이스를 도입하고 Supabase 구현을 분리 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
모든 뷰의 하드코딩된 문자열을 AppStrings로 중앙 관리하여 향후 i18n 적용 및 문자열 일관성 유지를 용이하게 함 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ucture 뷰에 흩어진 Color 리터럴을 AppColors로 통합하고 _Pink, _Violet 그룹 및 시맨틱 색상(textTertiary, brandAccent 등) 추가 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
서비스 Ok/Error 응답에 따른 반환값 및 예외 발생 검증 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BabyRegistrationViewModel, InviteCodeViewModel, BabyProfileSetupViewModel의 상태 관리, 유효성 검증, 비동기 동작 및 에러 처리 테스트 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
|
||
| Future<Result<String>> joinBabyByInviteCode({ |
There was a problem hiding this comment.
parameter 중 code를 재사용 할 필요없음. 아기의 id 로 조인하는거 고려해보기
| required String nickname, | ||
| }); | ||
|
|
||
| Future<Result<BabySummary?>> verifyInviteCode(String code); |
There was a problem hiding this comment.
검증용 데이터 타입을 만들고 id 를 같이 전달 하면 어떨까요?
| if (result == null) return Result.ok(null); | ||
|
|
||
| if (result is Map<String, dynamic>) { | ||
| return Result.ok(BabySummary.fromJson(result)); |
There was a problem hiding this comment.
from json이 실패할경우를 result 로 처리 혹은 최소 로그 추가 권장 드립니다.
| return Result.ok(BabySummary.fromJson(result)); | ||
| } | ||
|
|
||
| if (result is List && result.isNotEmpty) { |
There was a problem hiding this comment.
57 번 조건과, 72번 조건, 60번 조건중 return 될 데이터 타입에 맞춰서 하나만 사용.
|
|
||
| return Result.ok(result.toString()); | ||
| } on Exception catch (e) { | ||
| return Result.error(AppException('아기 참여에 실패했습니다.', cause: e)); |
There was a problem hiding this comment.
label로 해당 메세지를 사용한다면, presentation / data layer 책임 분리가 필요해보임
| } catch (e) { | ||
| _error = '오류가 발생했습니다. 다시 시도해주세요.'; | ||
| notifyListeners(); | ||
| rethrow; |
There was a problem hiding this comment.
exception 을 propagate 를 할 필요 있는지 확인
| :final birthDate, | ||
| :final dueDate, | ||
| ) => | ||
| await _repository.createBaby( |
There was a problem hiding this comment.
아기 등록과 유저 롤 설정 스탭을 분리
아기 등록 혹은 코드 등록시 유저와 아기를 매핑
로그인시 유저의 아기 id 확인 -> 아기가 있다면 역할 확인.
역할이 없다면 롤 설정으로 routing.
| State<BabyProfileSetupView> createState() => _BabyProfileSetupViewState(); | ||
| } | ||
|
|
||
| class _BabyProfileSetupViewState extends State<BabyProfileSetupView> { |
| import 'package:yuktoe/onboarding/view_models/invite_code_view_model.dart'; | ||
| import 'package:yuktoe/routing/router.dart'; | ||
|
|
||
| class InviteCodeView extends StatefulWidget { |
There was a problem hiding this comment.
stateful widget 필요한지 체크해보기
| } | ||
|
|
||
| void _showBabyConfirmModal(BabySummary baby) { | ||
| final genderText = baby.gender == Gender.male ? AppStrings.maleLabel : AppStrings.femaleLabel; |
There was a problem hiding this comment.
view model 로 presentation 로직 옮기기
📝 Summary
🔍 Changes
프로젝트 설정
lib/routing/router.dart)AppTextStyles디자인 시스템 추가 (display ~ caption 스케일, bold/semibold/medium/regular 가중치)AppColors에 error 색상 추가Data Layer
BabyRegistrationRepository인터페이스 정의: createBaby, verifyInviteCode, joinBabyByInviteCodeDomain Layer
UI Layer (MVVM)
DI 및 라우팅
🧪 Test
BabyRegistrationRepositoryImplcreateBaby: Service 성공(Ok) 시 babyId 반환, 실패(Error) 시 예외 전파verifyInviteCode: 유효한 코드 시 BabySummary 반환, null 반환, 실패 시 예외 전파joinBabyByInviteCode: Service 성공 시 babyId 반환, 실패 시 예외 전파BabyRegistrationViewModeltoggleAgreedToTerms토글 동작 검증isValid: 필수 필드(이름, 성별, 생년월일, 약관동의) 누락 시 false, 모두 입력 시 true, dueDate 선택사항 확인InviteCodeViewModelsetCode,toggleAgreedToTerms값 갱신 및 리스너 알림isValid: 코드 미입력/공백/약관 미동의 시 false, 모두 충족 시 trueverifyInviteCode: 성공 시 verifiedBaby 설정, null 반환 처리, 실패 시 에러 메시지 설정, 로딩 상태 변화 추적, 로딩 중 isValid false, 재호출 시 이전 에러/결과 초기화clearVerifiedBaby: verifiedBaby와 error 초기화 및 리스너 알림BabyProfileSetupViewModelsetRelationship,setNickname값 갱신 및 리스너 알림setNickname: 최대 길이 초과 시 무시, 최대 길이 정확히 허용isValid: relationship 미선택/nickname 미입력/공백 시 false, 모두 입력 시 truesubmit(CreateBabyFlow): createBaby 호출 및 babyId 반환, dueDate null 처리, 실패 시 에러 설정 및 예외 재전파submit(JoinBabyFlow): joinBabyByInviteCode 호출 및 babyId 반환, 실패 시 에러 설정 및 예외 재전파🔗 Related Issues