Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitoyama committed Sep 3, 2024
2 parents 0421e8e + 779ab5c commit 42cf45f
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 44 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
name: Mod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.22.2'
- uses: actions/checkout@v4
go-version-file: 'go.mod'
- uses: actions/[email protected]
with:
path: ~/go/pkg/mod
Expand All @@ -31,10 +31,10 @@ jobs:
env:
GOCACHE: "/tmp/go/cache"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.22.2'
- uses: actions/checkout@v4
go-version-file: 'go.mod'
- uses: actions/[email protected]
with:
path: ~/go/pkg/mod
Expand Down Expand Up @@ -66,10 +66,10 @@ jobs:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: anke-to
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.22.2'
- uses: actions/checkout@v4
go-version-file: 'go.mod'
- uses: actions/[email protected]
with:
path: ~/go/pkg/mod
Expand Down Expand Up @@ -97,10 +97,10 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.22.2'
- uses: actions/checkout@v4
go-version-file: 'go.mod'
- name: golangci-lint
uses: reviewdog/[email protected]
with:
Expand Down
70 changes: 38 additions & 32 deletions docs/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -882,17 +882,20 @@ components:
ResponsesWithQuestionnaireInfo:
type: array
items:
allOf:
- $ref: "#/components/schemas/Response"
- type: object
properties:
questionnaire_info:
allOf:
- $ref: "#/components/schemas/QuestionnaireTitle"
- $ref: "#/components/schemas/QuestionnaireResponseDueDateTime"
- $ref: "#/components/schemas/QuestionnaireCreatedAt"
- $ref: "#/components/schemas/QuestionnaireModifiedAt"
- $ref: "#/components/schemas/QuestionnaireIsTargetingMe"
$ref: "#/components/schemas/ResponseWithQuestionnaireInfoItem"
ResponseWithQuestionnaireInfoItem:
type: object
allOf:
- $ref: "#/components/schemas/Response"
- type: object
properties:
questionnaire_info:
allOf:
- $ref: "#/components/schemas/QuestionnaireTitle"
- $ref: "#/components/schemas/QuestionnaireResponseDueDateTime"
- $ref: "#/components/schemas/QuestionnaireCreatedAt"
- $ref: "#/components/schemas/QuestionnaireModifiedAt"
- $ref: "#/components/schemas/QuestionnaireIsTargetingMe"
ResponseBody:
oneOf:
- $ref: "#/components/schemas/ResponseBodyText"
Expand Down Expand Up @@ -960,27 +963,30 @@ components:
Result:
type: array
items:
allOf:
- $ref: "#/components/schemas/QuestionnaireID"
- type: object
properties:
response_id:
type: integer
example: 1
submitted_at:
type: string
format: date-time
example: 2020-01-01T00:00:00+09:00
modified_at:
type: string
format: date-time
example: 2020-01-01T00:00:00+09:00
required:
- response_id
- respondent
- submitted_at
- modified_at
- $ref: "#/components/schemas/NewResponse"
$ref: "#/components/schemas/ResultItem"
ResultItem:
type: object
allOf:
- $ref: "#/components/schemas/QuestionnaireID"
- type: object
properties:
response_id:
type: integer
example: 1
submitted_at:
type: string
format: date-time
example: 2020-01-01T00:00:00+09:00
modified_at:
type: string
format: date-time
example: 2020-01-01T00:00:00+09:00
required:
- response_id
- respondent
- submitted_at
- modified_at
- $ref: "#/components/schemas/NewResponse"
UsersAndGroups:
type: object
properties:
Expand Down
8 changes: 4 additions & 4 deletions router/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ func (r *Response) EditResponse(c echo.Context) error {
c.Logger().Errorf("failed to get scale labels: %+v", err)
return echo.NewHTTPError(http.StatusInternalServerError, err)
}
scaleLabelMap := make(map[int]*model.ScaleLabels, len(scaleLabels))
scaleLabelMap := make(map[int]model.ScaleLabels, len(scaleLabels))
for _, label := range scaleLabels {
scaleLabelMap[label.QuestionID] = &label
scaleLabelMap[label.QuestionID] = label
}

// LinearScaleのパターンマッチ
Expand All @@ -334,9 +334,9 @@ func (r *Response) EditResponse(c echo.Context) error {
case "LinearScale":
label, ok := scaleLabelMap[body.QuestionID]
if !ok {
label = &model.ScaleLabels{}
label = model.ScaleLabels{}
}
if err := r.CheckScaleLabel(*label, body.Body.ValueOrZero()); err != nil {
if err := r.CheckScaleLabel(label, body.Body.ValueOrZero()); err != nil {
c.Logger().Infof("invalid scale label: %+v", err)
return echo.NewHTTPError(http.StatusBadRequest, err)
}
Expand Down

0 comments on commit 42cf45f

Please sign in to comment.