Conversation
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
spec-core | 8b08cc5 | Commit Preview URL Branch Preview URL |
Jan 03 2026, 09:37 AM |
There was a problem hiding this comment.
Pull request overview
このPRは、アクティビティ機能に3つの統計エンドポイントを追加しています。現在在室中のユーザー一覧、場所の訪問履歴(日/週/月単位)、およびユーザーの入室記録一覧を取得できる機能が実装されています。
主な変更点:
- 3つの新規GETエンドポイントの追加(current users、place history、user records)
- 対応するSQLクエリ、APIハンドラ、OpenAPI仕様の実装
- ページネーション機能を含むユーザー入室記録取得API
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/db/sql/activity/select_current_users.sql | 現在在室中のユーザーを取得するSQLクエリ(ROW_NUMBER()を使用した最新レコードの抽出) |
| pkg/db/sql/activity/select_place_history.sql | 指定期間内の場所訪問履歴を集計するSQLクエリ |
| pkg/db/sql/activity/select_user_records.sql | ユーザーの入室記録をページネーション対応で取得するSQLクエリ |
| pkg/db/sql/activity/select_user_records_count.sql | ユーザーの入室記録の総数を取得するSQLクエリ |
| pkg/activity/get_activity_place_place_current.go | 現在在室中のユーザー一覧取得の実装 |
| pkg/activity/get_activity_place_place_history.go | 場所の訪問履歴取得と日付範囲計算ロジックの実装 |
| pkg/activity/get_activity_user_user_id_records.go | ユーザー入室記録一覧取得の実装(ページネーション対応) |
| pkg/api/server/get_activity_place_place_current.go | 現在在室中のユーザー一覧エンドポイントのハンドラ |
| pkg/api/server/get_activity_place_place_history.go | 場所の訪問履歴エンドポイントのハンドラ |
| pkg/api/server/get_activity_user_user_id_records.go | ユーザー入室記録エンドポイントのハンドラ |
| pkg/api/server.gen.go | 3つの新規エンドポイントのルーティング設定を追加 |
| pkg/api/models.gen.go | 新規エンドポイントのリクエスト/レスポンスモデルを定義 |
| pkg/api/spec.gen.go | OpenAPI仕様の生成コード更新 |
| document/paths/activity_place_place_current.yml | 現在在室中のユーザー一覧エンドポイントのOpenAPI定義 |
| document/paths/activity_place_place_history.yml | 場所の訪問履歴エンドポイントのOpenAPI定義 |
| document/paths/activity_user_user_id_records.yml | ユーザー入室記録エンドポイントのOpenAPI定義 |
| document/schemas/*.yml | 各エンドポイントのレスポンススキーマ定義 |
| document/paths.yml | 新規エンドポイントのパス登録 |
| document/schemas.yml | 新規スキーマの登録 |
| document/bundle.gen.yml | OpenAPI仕様バンドル更新 |
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.

概要
変更内容
追加エンドポイント
GET /activity/place/{place}/current- 現在在室中のユーザー一覧GET /activity/place/{place}/history- 場所の訪問履歴(期間指定可能)GET /activity/user/{userId}/records- ユーザーの入室記録一覧(ページネーション対応)実装ファイル
SQLクエリ
OpenAPI仕様
テストプラン
以下のcurlコマンドで各エンドポイントをテストできます。
1. 現在在室中のユーザー一覧取得
期待される結果:
{ "users": [ { "userId": "9bca677f-dfe5-11f0-a248-724daa63eb6e", "username": "山田太郎", "shortIntroduction": "よろしくお願いします", "iconUrl": "https://example.com/icon.jpg", "checkedInAt": "2025-12-29T10:30:00+09:00" } ] }空の場合:
{ "users": [] }2. 場所の訪問履歴取得(日単位)
期待される結果:
{ "users": [ { "userId": "9bca677f-dfe5-11f0-a248-724daa63eb6e", "username": "山田太郎", "shortIntroduction": "よろしくお願いします", "iconUrl": "https://example.com/icon.jpg", "checkInCount": 3 } ] }3. 場所の訪問履歴取得(週単位)
期待される結果: 指定日を含む週の1週間前の月曜00:00:00 ~ 指定日を含む週の日曜23:59:59の期間の訪問履歴
4. 場所の訪問履歴取得(月単位)
期待される結果: 指定日の1か月前の1日00:00:00 ~ 指定日を含む月の月末23:59:59の期間の訪問履歴
エラーケース(不正なperiod値):
期待される結果:
400 Bad Request- "periodはday、week、monthのいずれかである必要があります"エラーケース(不正な日付形式):
期待される結果:
400 Bad Request- "日付の形式が不正です"5. ユーザーの入室記録一覧取得(基本)
期待される結果:
{ "records": [ { "recordId": "abc123...", "place": "omiya-bushitsu", "checkedInAt": "2025-12-29T10:00:00+09:00", "checkedOutAt": "2025-12-29T18:00:00+09:00", "initialCheckedInAt": "2025-12-29T10:00:00+09:00", "initialCheckedOutAt": "2025-12-29T18:00:00+09:00" } ], "total": 42, "offset": 0, "limit": 50 }6. ユーザーの入室記録一覧取得(場所フィルタ付き)
期待される結果: 指定した場所の記録のみが返される
7. ユーザーの入室記録一覧取得(ページネーション)
期待される結果:
{ "records": [...], "total": 42, "offset": 10, "limit": 20 }8. ユーザーの入室記録一覧取得(複数パラメータ組み合わせ)
期待される結果: 指定した場所の記録が、ページネーション付きで返される
9. 在室中のレコード(checkedOutAtがnull)
期待される結果:
{ "records": [ { "recordId": "abc123...", "place": "omiya-bushitsu", "checkedInAt": "2025-12-29T10:00:00+09:00", "checkedOutAt": null, "initialCheckedInAt": "2025-12-29T10:00:00+09:00", "initialCheckedOutAt": null } ], "total": 1, "offset": 0, "limit": 50 }補足情報
offset=0,limit=50checkedOutAtとinitialCheckedOutAtは在室中の場合nullになりますinitialCheckedInAtとinitialCheckedOutAtは編集前の元の時刻を保持しますcheckedInAt/checkedOutAtと同じ値になります🤖 Generated with Claude Code