Skip to content

科目一覧を syllabus_id 昇順で返却#50

Merged
kantacky merged 1 commit into
mainfrom
feat/sort-subjects-by-syllabus-id
Apr 22, 2026
Merged

科目一覧を syllabus_id 昇順で返却#50
kantacky merged 1 commit into
mainfrom
feat/sort-subjects-by-syllabus-id

Conversation

@kantacky
Copy link
Copy Markdown
Member

@kantacky kantacky commented Apr 22, 2026

背景

GET /v1/subjects(科目一覧取得)はリポジトリ層で ORDER BY を指定しておらず、DB が返す順序(実質未定義)で結果を返していた。クライアント側での並び順が安定しないため、サーバ側で一貫した順序を保証する必要がある。

変更点

  • internal/repository/subject.goSubjectRepository.List において、Find 実行前に Order("syllabus_id ASC") を追加し、科目一覧を syllabus_id 昇順で返却するようにした。

確認内容

  • GET /v1/subjects のレスポンスが syllabus_id 昇順で並んでいること
  • q / year / grades などのフィルタ併用時も順序が維持されること

🤖 Generated with Claude Code

  • dev環境のAdmin科目一覧で確認済み

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kantacky kantacky self-assigned this Apr 22, 2026
@kantacky kantacky marked this pull request as ready for review April 22, 2026 08:42
@kantacky kantacky requested review from a team, Copilot, hikaru-0602 and masaya-osuga April 22, 2026 08:42
@kantacky kantacky merged commit 4171d22 into main Apr 22, 2026
7 checks passed
@kantacky kantacky deleted the feat/sort-subjects-by-syllabus-id branch April 22, 2026 08:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

GET /v1/subjects の返却順がDB依存で不安定だった点を解消し、サーバ側で一貫した並び順(syllabus_id 昇順)を保証するための変更です。

Changes:

  • SubjectRepository.List のクエリに ORDER BY syllabus_id ASC を追加し、科目一覧の順序を安定化

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants