教員・教員室の一覧にソート順を追加#51
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Floor/Nameはroomsテーブル側の列でPreloadによる別クエリ経由で 取得しているため、リポジトリ層でin-memoryソートする。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
in-memoryソートからDB側での並び替えに切り替え、 rooms テーブルと JOIN して year, floor, name の昇順で取得する。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
教員一覧・教員室一覧の返却順をAPI仕様として安定させるため、Repository のDBクエリにソート順(ORDER BY)を追加するPRです。
Changes:
GET /v1/faculties相当の取得をemail昇順で返すように変更GET /v1/faculty-rooms相当の取得をyear→rooms.floor→rooms.name昇順で返すように変更(roomsをJOINしてDB側でソート)faculty-roomsのyearフィルタ条件をfaculty_rooms.yearに修飾して曖昧参照を回避
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/repository/faculty.go | 教員一覧クエリに ORDER BY email ASC を追加 |
| internal/repository/faculty_room.go | 教員室一覧クエリで rooms をJOINし、year/floor/name の複合ソート+WHERE句の列修飾を追加 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
やったこと
GET /v1/faculties) をemail昇順で返すようにしたGET /v1/faculty-rooms) をyear→rooms.floor→rooms.nameの昇順で返すようにしたfaculty_roomsとroomsをJOINし、DB 側のORDER BYでソートyearの WHERE 句をfaculty_rooms.yearに明示して列名の曖昧参照を回避GET /v1/rooms) をfloor→nameの昇順で返すようにした確認したこと
go build ./...が通ることメモ
domain.Floor(Floor1〜Floor7) の列挙値であり、文字列昇順で想定通りの並びになる