Skip to content

refactor: v2移行準備 - #109

Merged
nakaterm merged 7 commits into
developfrom
refactor/v2-preparation
Oct 22, 2026
Merged

nakaterm merged 7 commits into
developfrom
refactor/v2-preparation

Conversation

@nakaterm

@nakaterm nakaterm commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
  • Express 時代の Cookie への対応を終了
  • テスト基盤を作る
  • route から service を切り出す
  • slot バリデーションロジックを新規作成

nakaterm and others added 4 commits October 22, 2026 18:53
テストから main.ts を import するとサーバーが起動してしまうため。
prisma / nanoid / cookieOptions も db.ts / lib/id.ts / config.ts に移し、main.ts への循環 import をなくす。
config.ts がモジュールの評価時に環境変数を読むので、main.ts の先頭で dotenv/config を読み込む。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- テスト用の DB は compose の Postgres 上の itsuhima_test (TEST_DATABASE_URL で上書き可)。
  globalSetup で migrate deploy し、各テストの前に全テーブルを TRUNCATE する
- browserId のテストと、routes/projects.ts の挙動を固定するテストを追加
- tsconfig を型チェック用 (テストを含む) とビルド用 (tsconfig.build.json) に分け、CI で typecheck する
- vitest 5 が Node 22 以上を要求するので、CI と Dockerfile を Node 24 に上げる
- DB を使うテストはローカルで回し、CI では実行しない

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nakaterm
nakaterm marked this pull request as draft October 22, 2026 11:02
nakaterm and others added 3 commits October 22, 2026 20:33
Hono ハンドラに埋まっていた権限判定と Prisma 呼び出しを
server/src/services/ に切り出す。振る舞いは変えない (f270885 の
Slot バリデーション・Actor・updatedAt などは入れない)。

- サービスは HTTP を知らない。ServiceError は業務上の理由を持ち、
  onError で HTTP ステータスに変換する
- エラーレスポンスが RPC の型に乗らなくなるため、クライアントの
  エラーメッセージの読み出しを readErrorMessage にまとめる

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
API を直接呼ぶと、イベントの期間・時間帯の外や、15 分単位でない
Slot、別のイベントの参加形態を使った Slot を保存できた (#91)。
保存前に検証し、違反は 400 にする。存在しないイベントへの提出は
500 ではなく 404 にする。

時間帯が未設定のイベントでは、Web UI が 23:45〜24:00 の Slot の
終わりを翌日の 0:00 として送るので、日をまたいだとは見なさない。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nakaterm
nakaterm marked this pull request as ready for review October 22, 2026 11:51
@nakaterm
nakaterm merged commit ba93fdd into develop Oct 22, 2026
3 checks passed
@nakaterm
nakaterm deleted the refactor/v2-preparation branch October 22, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant