feat: テンプレート編集の保存処理を複数曜日一括対応に変更#147
Merged
stotic-dev merged 4 commits intoMay 15, 2026
Merged
Conversation
Collaborator
Generated by 🚫 Danger Swift against 528aca1 |
Collaborator
Generated by 🚫 Danger Swift against 528aca1 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
経緯
関連Issue: #140
家事週間テンプレート機能(#67)の実装の一環。
これまで
updateDayは曜日単位での更新しか行えず、画面で複数の曜日をまとめて編集して保存することができなかった。またHouseworkTemplateMetaに楽観的ロック用のversionプロパティが直接生えており、Domain 層が Infrastructure 層の永続化都合を持ってしまっていた。これらを解消するため、保存処理を複数曜日の一括更新に変更し、
versionを Domain から切り離す形に整理した。実装内容
保存処理を複数曜日の一括更新に変更
HouseworkTemplateClient.updateDay(単一曜日)をupdateDays(複数曜日)に置き換え、Firestore のトランザクション内で複数のHouseworkTemplateDayを一括書き込みするよう変更HouseworkTemplateMetaからversionを分離HouseworkTemplateMetaからversionを削除し、Infrastructure 層にHouseworkTemplateMetaDocument(templateId/name/version)を新設して Firestore とのマッピングを担わせたversionは永続化レイヤー固有の関心事であり、Domain モデルが知るべきではないため切り分けた編集中の version は SnapshotListener で追従
addMetaVersionSnapshotListenerを新設し、編集中はメタドキュメントのversionを購読してHouseworkTemplateEditStore.currentVersionを自動更新する構成にしたcurrentVersionを持ち続けると他クライアントの更新と必ず衝突してしまうため、Listener で追従させることで楽観的ロックの整合性を担保FirestoreServiceに単一ドキュメント用のaddSnapshotListenerを追加Days 監視と保存責務を
HouseworkTemplateListStore側に移動HouseworkTemplateEditStoreが持っていたdaysの SnapshotListener /saveDayをHouseworkTemplateListStoreのstartObservingDays/stopObservingDays/saveDaysに移行selectedDaysを持つことで「表示中のテンプレートの曜日定義」というドメイン状態を一箇所に集約。Edit 側は「編集セッション固有の状態(editors / currentVersion / keepalive)」だけに責務を絞ったselectedDaysをローカル更新する(既存の dayOfWeek は置換、未登録は追加)確認内容
HouseworkTemplateListStoreTest/HouseworkTemplateEditStoreTest/HouseworkTemplateEditStoreMetaVersionListenerTestが通ること