Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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(newpagequery param; response now includespage_maxandresponse_groups). - Implemented grouped + paginated DB retrieval for “my responses” via a new
GetMyResponseGroupsrepository 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
respondentfor anonymous questionnaires, but it doesn't enforce that invariant itself (it just sets IsAnonymous). This makes it easy to accidentally leak respondent IDs; consider settingrespondent = nilinside this function whenisAnonymousis true (or removing therespondentparameter 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.
Eraxyso
left a comment
There was a problem hiding this comment.
LGTM
ちょっと細かいとこだけ2点確認させてください
model/respondents_impl.go
Outdated
| return query. | ||
| Order("MAX(respondents.modified_at) DESC"). | ||
| Order("first_response_id"), nil | ||
| case "traqid", "-traqid": |
There was a problem hiding this comment.
全部myResponseなのでこのsortパラメーターはいらないと思います。swaggerからも消した方がいいと思います
handler/response.go
Outdated
| if err != nil { | ||
| var httpErr *echo.HTTPError | ||
| if errors.As(err, &httpErr) { | ||
| return httpErr |
There was a problem hiding this comment.
[nits]
ここのエラー処理を他のところと統一してほしい
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
No description provided.