Skip to content

Add paging to myResponses#1507

Merged
kaitoyama merged 8 commits intofix/openapifrom
fix/myresponses-paging
Apr 8, 2026
Merged

Add paging to myResponses#1507
kaitoyama merged 8 commits intofix/openapifrom
fix/myresponses-paging

Conversation

@kaitoyama
Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 10b50ccd-46b5-47a1-a99e-c71c561fe4c0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/myresponses-paging

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kaitoyama kaitoyama marked this pull request as ready for review March 29, 2026 07:32
@Eraxyso Eraxyso requested a review from Copilot March 30, 2026 11:16
Copy link
Copy Markdown

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

Adds pagination support to the GET /responses/myResponses endpoint by changing the response shape to include page metadata and grouping responses by questionnaire.

Changes:

  • Updated OpenAPI schema/params for myResponses (new page query param; response now includes page_max and response_groups).
  • Implemented grouped + paginated DB retrieval for “my responses” via a new GetMyResponseGroups repository method.
  • Updated controller + tests to consume the new grouped/paginated response model.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
openapi/types.go Changes ResponsesWithQuestionnaireInfo from array alias to paging object; adds page param type to GetMyResponsesParams.
openapi/spec.go Regenerates embedded swagger spec blob to reflect OpenAPI changes.
openapi/server.go Binds new optional page query parameter for getMyResponses.
model/respondents.go Adds MyResponseGroup / MyResponseQuestionnaireInfo types and new repo interface method.
model/respondents_impl.go Implements paginated “my responses grouped by questionnaire” query path.
controller/response.go Switches GetMyResponses to new repo method and returns paging metadata + groups.
controller/adapter.go Introduces respondentDetail2ResponseWithMetadata helper for response conversion with caller-provided anonymity/respondent metadata.
handler/response.go Passes through *echo.HTTPError returned from controller.
docs/swagger/swagger.yaml Updates endpoint description/params and response schema for paging.
controller/response_test.go Updates tests for new response shape and adds page-related assertions.
Comments suppressed due to low confidence (1)

controller/adapter.go:327

  • respondentDetail2ResponseWithMetadata relies on callers to nil out respondent for anonymous questionnaires, but it doesn't enforce that invariant itself (it just sets IsAnonymous). This makes it easy to accidentally leak respondent IDs; consider setting respondent = nil inside this function when isAnonymous is true (or removing the respondent parameter and deriving it from isAnonymous).
		IsAnonymous:     isAnonymous,
		IsDraft:         !respondentDetail.SubmittedAt.Valid,
		ModifiedAt:      respondentDetail.ModifiedAt,
		QuestionnaireId: respondentDetail.QuestionnaireID,
		Respondent:      respondent,

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

Copy link
Copy Markdown
Contributor

@Eraxyso Eraxyso left a comment

Choose a reason for hiding this comment

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

LGTM
ちょっと細かいとこだけ2点確認させてください

return query.
Order("MAX(respondents.modified_at) DESC").
Order("first_response_id"), nil
case "traqid", "-traqid":
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

全部myResponseなのでこのsortパラメーターはいらないと思います。swaggerからも消した方がいいと思います

if err != nil {
var httpErr *echo.HTTPError
if errors.As(err, &httpErr) {
return httpErr
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[nits]
ここのエラー処理を他のところと統一してほしい

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 22.04301% with 145 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.82%. Comparing base (bc34d44) to head (811140a).

Files with missing lines Patch % Lines
model/respondents_impl.go 0.00% 134 Missing ⚠️
controller/response.go 80.00% 6 Missing and 2 partials ⚠️
controller/adapter.go 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           fix/openapi    #1507      +/-   ##
===============================================
- Coverage        67.16%   64.82%   -2.34%     
===============================================
  Files               25       25              
  Lines             3706     3827     +121     
===============================================
- Hits              2489     2481       -8     
- Misses             851      982     +131     
+ Partials           366      364       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kaitoyama kaitoyama merged commit 6fef7bb into fix/openapi Apr 8, 2026
0 of 2 checks passed
@kaitoyama kaitoyama deleted the fix/myresponses-paging branch April 8, 2026 10:36
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