refactor!: 大学組織構造の型をランタイム定義から導出する設計に変更#111
Merged
KinjiKawaguchi merged 5 commits intodevelopfrom Mar 24, 2026
Merged
Conversation
ランタイムデータを単一の情報源とし、型を自動導出するように変更。 3ファイル(型定義・部分型・ランタイムデータ)を1ファイルに統合。 - as const + typeof で文字列リテラルの二重管理を解消 - 分配条件型により学部ごとの学科制約を維持 - getAffiliationSteps(): 学部ごとの動的階層ステップ生成関数を追加 - PartialAffiliation型もランタイムデータから導出 - 課程ラベルを正式名称(学士課程/修士課程/博士課程/専門職学位課程)に変更 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4071429 to
8b3629e
Compare
- field: "school" に修正(修士/博士/専門職のステップ) - 理学部の学科とコースを別ステップに分離 - CourseType 型を導入しヘルパー関数を型安全に - keysOf ヘルパーで Object.keys のリテラル型を維持 - getMaxYear の戻り値型を厳密化 - getDepartments → getSubdivisions にリネーム、JSDocで制限を明記 - faculties → institutions にリネーム(学部/研究科の汎用名) - getAffiliationSteps で不正courseTypeをexhaustiveに処理 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>
元のファイルにあった各フィールドの日本語注釈(/** 学部 */, /** 学科 */, etc.) と型ごとの@seeリンク、セクションコメントを復元。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
KinjiKawaguchi
added a commit
that referenced
this pull request
Mar 24, 2026
## Summary - Karte集約のドメインモデル、アプリケーション層(ユースケース)、インフラ層(Drizzleリポジトリ)を追加 - ConsultedAt型で日時精度(年/年月/日/日時)に対応 ## Dependencies このPRは以下がマージ済みであることを前提とします: - #111 大学組織構造の型をランタイム定義から導出する設計に変更 - #112 ドメイン定数を追加し型をランタイム定義から導出 ## What - **ドメイン層**: Karte集約(Karte, ConsultedAt, Assignee, SupportRecord, Consultation) - **アプリケーション層**: Create/Correct/Get/Import/List カルテユースケース - **インフラ層**: DrizzleKarteRepository、DBスキーマ(kartes, karte_assignees, karte_consultation_categories) - **ファクトリ**: createKarteUseCases ## Test plan - [ ] `npm run typecheck` が成功すること(依存PR マージ後) - [ ] `npm run test` が成功すること - [ ] Karteの作成・取得・一覧が動作すること 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/su-its/core/pull/103" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end --> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
getAffiliationSteps(): 学部ごとに異なる所属階層の動的ステップ生成関数を追加What
as constでランタイムデータを定義し、分配条件型(distributive conditional types)で学部ごとの学科制約を維持したまま型を導出keysOf()ヘルパーでObject.keysのリテラル型を維持CourseType型を導入しヘルパー関数を型安全に(string→keyof typeof UNIVERSITY_STRUCTURE)faculties→institutions、departments→subdivisionsにリネームし学部/研究科の意味的曖昧さを解消field: "school"を使用(ドメインモデルと一致)Why
型定義とランタイムデータで同じ組織名を手書きしていた(DRY違反)。
値を先に定義し型を導出することで、1箇所の変更で型もUIデータも更新される。
Test plan
npm run typecheckが成功することnpm run buildが成功することnpm run lintが成功すること🤖 Generated with Claude Code