Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions api/survey/v1/design/survey.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,23 @@ var _ = Service("survey", func() {
Example("b03cdbaf-53b1-4d47-bc04-dd7e459dd309")
})

Attribute("project_uid", String, "Optional LFX Project UID (V2) to filter survey data", func() {
Example("qa1e8536-a985-4cf5-b981-a170927a1d11")
})

Attribute("project_uids", String, "Optional comma-delimited list of LFX Project UIDs (V2). Should not be combined with project_uid", func() {
Example("qa1e8536-a985-4cf5-b981-a170927a1d11,qa1e8536-a985-4cf5-b981-a170927a1d12")
})

Required("survey_uid")
})

Result(SurveyScheduleResult)

HTTP(func() {
GET("/surveys/{survey_uid}")
Param("project_uid")
Param("project_uids")
Response(StatusOK)
Response("BadRequest", StatusBadRequest)
Response("Unauthorized", StatusUnauthorized)
Expand Down
2 changes: 1 addition & 1 deletion charts/lfx-v2-survey-service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ apiVersion: v2
name: lfx-v2-survey-service
description: LFX Platform V2 Survey Service chart
type: application
version: 0.1.2
version: 0.1.3
appVersion: "latest"
12 changes: 12 additions & 0 deletions docs/api-contracts/itx-surveys-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ Authorization: Bearer <jwt_token>

- `survey_id` (string, required) - Survey identifier

**Query Parameters**:

- `project_uid` (string, optional) - LFX Project UID (V2 format) to filter survey data
- `project_uids` (string, optional) - Comma-delimited list of LFX Project UIDs (V2 format). Should not be combined with `project_uid`

**Response**: `200 OK`

Response body is identical to Create Survey response.
Expand All @@ -192,6 +197,11 @@ Authorization: Bearer <oauth2_m2m_token>

- `survey_id` (string, required) - Survey identifier

**Query Parameters**:

- `project_id` (string, optional) - LFX Project ID (V1 SFID format) to filter survey data
- `project_ids` (string, optional) - Comma-delimited list of LFX Project IDs (V1 SFID format)

**Response**: `200 OK`

Response body is identical to ITX Create Survey response.
Expand All @@ -201,6 +211,8 @@ Response body is identical to ITX Create Survey response.
| Proxy API (LFX) | ITX API | Notes |
|-----------------|---------|-------|
| `/surveys/{survey_id}` | `/v2/surveys/{survey_id}/schedule` | Path differs - proxy has shorter path |
| `project_uid` query param | `project_id` query param | Proxy accepts V2 UID, maps to V1 SFID for ITX |
| `project_uids` query param | `project_ids` query param | Proxy accepts comma-delimited V2 UIDs, maps to V1 SFIDs for ITX |
| All response fields | Same | Response fields are identical |

---
Expand Down
16 changes: 11 additions & 5 deletions gen/http/cli/survey_api/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gen/http/openapi.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions gen/http/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ paths:
* `manage:surveys`
operationId: survey#get_survey
parameters:
- name: project_uid
in: query
description: Optional LFX Project UID (V2) to filter survey data
required: false
type: string
- name: project_uids
in: query
description: Optional comma-delimited list of LFX Project UIDs (V2). Should not be combined with project_uid
required: false
type: string
- name: survey_uid
in: path
description: Survey identifier
Expand Down
2 changes: 1 addition & 1 deletion gen/http/openapi3.json

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions gen/http/openapi3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,24 @@ paths:
description: Get survey details (proxies to ITX GET /v2/surveys/{survey_uid})
operationId: survey#get_survey
parameters:
- name: project_uid
in: query
description: Optional LFX Project UID (V2) to filter survey data
allowEmptyValue: true
schema:
type: string
description: Optional LFX Project UID (V2) to filter survey data
example: qa1e8536-a985-4cf5-b981-a170927a1d11
example: qa1e8536-a985-4cf5-b981-a170927a1d11
- name: project_uids
in: query
description: Optional comma-delimited list of LFX Project UIDs (V2). Should not be combined with project_uid
allowEmptyValue: true
schema:
type: string
description: Optional comma-delimited list of LFX Project UIDs (V2). Should not be combined with project_uid
example: qa1e8536-a985-4cf5-b981-a170927a1d11,qa1e8536-a985-4cf5-b981-a170927a1d12
example: qa1e8536-a985-4cf5-b981-a170927a1d11,qa1e8536-a985-4cf5-b981-a170927a1d12
- name: survey_uid
in: path
description: Survey identifier
Expand Down
16 changes: 15 additions & 1 deletion gen/http/survey/client/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions gen/http/survey/client/encode_decode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions gen/http/survey/server/encode_decode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion gen/http/survey/server/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions gen/survey/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/domain/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type SurveyClient interface {
ScheduleSurvey(ctx context.Context, req *itx.ScheduleSurveyRequest) (*itx.SurveyScheduleResponse, error)

// GetSurvey retrieves survey details from ITX
GetSurvey(ctx context.Context, surveyID string) (*itx.SurveyScheduleResponse, error)
GetSurvey(ctx context.Context, surveyID string, queryParams *itx.GetSurveyParams) (*itx.SurveyScheduleResponse, error)

// UpdateSurvey updates a survey in ITX (only when status is "disabled")
UpdateSurvey(ctx context.Context, surveyID string, req *itx.UpdateSurveyRequest) (*itx.SurveyScheduleResponse, error)
Expand Down
24 changes: 21 additions & 3 deletions internal/infrastructure/proxy/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,28 @@ func (c *Client) ScheduleSurvey(ctx context.Context, req *itx.ScheduleSurveyRequ
}

// GetSurvey retrieves survey details from ITX
func (c *Client) GetSurvey(ctx context.Context, surveyID string) (*itx.SurveyScheduleResponse, error) {
func (c *Client) GetSurvey(ctx context.Context, surveyID string, params *itx.GetSurveyParams) (*itx.SurveyScheduleResponse, error) {
// Build URL with query parameters
baseURL := fmt.Sprintf("%sv2/surveys/%s/schedule", c.config.BaseURL, surveyID)
parsedURL, err := url.Parse(baseURL)
if err != nil {
return nil, domain.NewInternalError("failed to parse URL", err)
}

// Add query parameters if provided
if params != nil {
query := parsedURL.Query()
if params.ProjectID != nil && *params.ProjectID != "" {
query.Add("project_id", *params.ProjectID)
}
if params.ProjectIDs != nil && *params.ProjectIDs != "" {
query.Add("project_ids", *params.ProjectIDs)
}
parsedURL.RawQuery = query.Encode()
}

// Create HTTP request
url := fmt.Sprintf("%sv2/surveys/%s/schedule", c.config.BaseURL, surveyID)
httpReq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
httpReq, err := http.NewRequestWithContext(ctx, http.MethodGet, parsedURL.String(), nil)
if err != nil {
return nil, domain.NewInternalError("failed to create request", err)
}
Expand Down
Loading