Skip to content

Commit

Permalink
[ID-39]Add extras field to survey data (#45)
Browse files Browse the repository at this point in the history
* set the Changelog.md

* add "extras" to the SurveyData doc

* add "extras" to the model and set it as nullable

---------

Co-authored-by: Stefan Vitanov <[email protected]>
  • Loading branch information
stefanvit and Stefan Vitanov authored Jul 23, 2024
1 parent 00f1546 commit dc54d4e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Add extras field to survey data [#39](https://github.com/rokwire/surveys-building-block/issues/39)
### Fixed
- Fix "start_date" and "end_date" [#43](https://github.com/rokwire/surveys-building-block/issues/43)

Expand Down
23 changes: 12 additions & 11 deletions core/model/surveys.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,18 @@ type SurveyStats struct {

// SurveyData is data stored for a Survey
type SurveyData struct {
Section *string `json:"section,omitempty" bson:"section,omitempty"`
Sections []string `json:"sections,omitempty" bson:"sections,omitempty"`
AllowSkip bool `json:"allow_skip" bson:"allow_skip"`
Text string `json:"text" bson:"text"`
MoreInfo string `json:"more_info" bson:"more_info"`
DefaultFollowUpKey *string `json:"default_follow_up_key" bson:"default_follow_up_key"`
DefaultResponseRule *string `json:"default_response_rule" bson:"default_response_rule"`
FollowUpRule *string `json:"follow_up_rule" bson:"follow_up_rule"`
ScoreRule *string `json:"score_rule" bson:"score_rule"`
Replace bool `json:"replace" bson:"replace"`
Response interface{} `json:"response" bson:"response"`
Section *string `json:"section,omitempty" bson:"section,omitempty"`
Sections []string `json:"sections,omitempty" bson:"sections,omitempty"`
AllowSkip bool `json:"allow_skip" bson:"allow_skip"`
Text string `json:"text" bson:"text"`
MoreInfo string `json:"more_info" bson:"more_info"`
DefaultFollowUpKey *string `json:"default_follow_up_key" bson:"default_follow_up_key"`
DefaultResponseRule *string `json:"default_response_rule" bson:"default_response_rule"`
FollowUpRule *string `json:"follow_up_rule" bson:"follow_up_rule"`
ScoreRule *string `json:"score_rule" bson:"score_rule"`
Replace bool `json:"replace" bson:"replace"`
Response interface{} `json:"response" bson:"response"`
Extras *map[string]interface{} `json:"extras" bson:"extras"`

Type string `json:"type" bson:"type"`

Expand Down
3 changes: 3 additions & 0 deletions driver/web/docs/gen/def.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,9 @@ components:
type: boolean
response:
type: object
extras:
type: object
nullable: true
type:
type: string
correct_answer:
Expand Down
3 changes: 3 additions & 0 deletions driver/web/docs/schemas/surveys/SurveyData.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ properties:
type: boolean
response:
type: object
extras:
type: object
nullable: true
type:
type: string
correct_answer:
Expand Down

0 comments on commit dc54d4e

Please sign in to comment.