[LFXV2-1149] Add project_uid and project_uids query parameters to GET survey endpoint#7
Open
[LFXV2-1149] Add project_uid and project_uids query parameters to GET survey endpoint#7
Conversation
- Added project_uid and project_uids query parameters to get_survey in Goa API design - Created GetSurveyParams struct in itx package to hold query parameters - Updated domain interface to accept query params struct - Updated proxy client to build URL with query parameters and pass to ITX - Added V2 to V1 ID mapping logic in service layer for both single and comma-delimited project UIDs - Created mapProjectUIDsV2ToV1 helper function using strings package - Regenerated Goa code with new query parameters The V2 API now accepts project_uid (V2 UID) which is mapped to project_id (V1 SFID) before being passed to ITX, maintaining backward compatibility with ITX V1 IDs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Andres Tobon <andrest2455@gmail.com>
- Added project_uid and project_uids query parameters to Proxy API section - Added project_id and project_ids query parameters to ITX API section - Updated field mapping table to show V2 to V1 ID mapping for query parameters - Documented that proxy accepts V2 UIDs and maps to V1 SFIDs for ITX 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Andres Tobon <andrest2455@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR adds optional project_uid and project_uids query parameters to the GET survey endpoint, enabling filtering of survey data by project context. The implementation handles V2 to V1 ID mapping automatically before calling the ITX API.
Changes:
- Added optional query parameters
project_uidandproject_uidsto the GET survey endpoint - Implemented V2 to V1 ID mapping in the service layer for both single and comma-delimited project UIDs
- Updated the proxy client to build URLs with query parameters using proper URL encoding
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| api/survey/v1/design/survey.go | Adds query parameter definitions to Goa API design |
| pkg/models/itx/models.go | Introduces GetSurveyParams struct for query parameters |
| internal/service/survey_service.go | Implements V2 to V1 ID mapping logic and parameter handling |
| internal/infrastructure/proxy/client.go | Updates proxy client to build URLs with query parameters |
| internal/domain/proxy.go | Updates SurveyClient interface signature |
| gen/* | Regenerated Goa code with new query parameters |
Comments suppressed due to low confidence (2)
internal/service/survey_service.go:168
- The implementation allows both
project_uidandproject_uidsto be provided simultaneously, but the API design states "Should not be combined with project_uid" in the description ofproject_uids. Consider adding validation to reject requests where both parameters are provided, or clarify the behavior when both are present.
if p.ProjectUID != nil || p.ProjectUids != nil {
queryParams = &itx.GetSurveyParams{}
// Map single project_uid from V2 to V1
if p.ProjectUID != nil && *p.ProjectUID != "" {
projectV1, err := s.idMapper.MapProjectV2ToV1(ctx, *p.ProjectUID)
if err != nil {
s.logger.ErrorContext(ctx, "failed to map project_uid to V1",
"project_uid", *p.ProjectUID,
"error", err,
)
return nil, mapDomainError(err)
}
queryParams.ProjectID = &projectV1
s.logger.DebugContext(ctx, "mapped project_uid",
"project_v2_uid", *p.ProjectUID,
"project_v1_sfid", projectV1,
)
}
// Map project_uids from V2 to V1 (comma-delimited list)
if p.ProjectUids != nil && *p.ProjectUids != "" {
projectV1IDs, err := s.mapProjectUIDsV2ToV1(ctx, *p.ProjectUids)
if err != nil {
s.logger.ErrorContext(ctx, "failed to map project_uids to V1",
"project_uids", *p.ProjectUids,
"error", err,
)
return nil, mapDomainError(err)
}
queryParams.ProjectIDs = &projectV1IDs
s.logger.DebugContext(ctx, "mapped project_uids",
"project_v2_uids", *p.ProjectUids,
"project_v1_sfids", projectV1IDs,
)
}
}
internal/service/survey_service.go:766
- If all comma-separated values in
project_uidsare empty or whitespace (e.g., " , , "), the function will return an empty string, which may result in sendingproject_ids=to the ITX API. Consider whether this is the intended behavior, or if you should return an error for this case. The same issue can occur with trailing commas like "uid1,uid2,".
// mapProjectUIDsV2ToV1 maps a comma-delimited list of project UIDs from V2 to V1
func (s *SurveyService) mapProjectUIDsV2ToV1(ctx context.Context, projectUIDs string) (string, error) {
if projectUIDs == "" {
return "", nil
}
// Split comma-delimited list and trim whitespace
v2UIDs := strings.Split(projectUIDs, ",")
v1IDs := make([]string, 0, len(v2UIDs))
// Map each UID from V2 to V1
for _, v2UID := range v2UIDs {
trimmed := strings.TrimSpace(v2UID)
if trimmed == "" {
continue
}
v1ID, err := s.idMapper.MapProjectV2ToV1(ctx, trimmed)
if err != nil {
s.logger.ErrorContext(ctx, "failed to map project UID to V1",
"project_v2_uid", trimmed,
"error", err,
)
return "", err
}
v1IDs = append(v1IDs, v1ID)
}
// Join back into comma-delimited string
return strings.Join(v1IDs, ","), nil
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Renamed queryParams to params in GetSurvey method for consistency - Bumped Helm chart version from 0.1.2 to 0.1.3 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Andres Tobon <andrest2455@gmail.com>
asithade
approved these changes
Feb 23, 2026
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.
Summary
Adds support for optional
project_uidandproject_uidsquery parameters to the GET survey endpoint, enabling filtering of survey data by project context.Ticket
LFXV2-1149
Changes
project_uidandproject_uidsquery parameters toget_surveyin Goa API designGetSurveyParamsstruct in itx package to encapsulate query parametersSurveyClientinterface to accept query params structmapProjectUIDsV2ToV1helper function using standard librarystringspackageImplementation Details
API Parameters
Both parameters accept V2 UIDs which are mapped to V1 SFIDs before calling ITX, maintaining consistency with the V2 API design.
V2 to V1 ID Mapping
The service layer handles mapping:
project_uid→project_id(V1 SFID)project_uids→project_ids(comma-delimited V1 SFIDs)Example Usage
🤖 Generated with Claude Code