From b77a5ca905f790a31d698ec3632d0f53450f9468 Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 5 Dec 2023 22:12:04 +0900 Subject: [PATCH 01/77] =?UTF-8?q?=E3=82=B9=E3=83=9A=E3=83=AB=E3=83=9F?= =?UTF-8?q?=E3=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 418 +++++++++++++++++++------------------- 1 file changed, 209 insertions(+), 209 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index e00c0971..ef313687 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -1,8 +1,8 @@ openapi: 3.0.0 servers: - - url: 'https://anke-to.trap.jp/api' + - url: "https://anke-to.trap.jp/api" description: production - - url: 'http://localhost:8080/api' + - url: "http://localhost:8080/api" description: local info: title: anke-to API @@ -10,7 +10,7 @@ info: description: anke-to API contact: name: traP - url: 'https://github.com/traPtitech/anke-to' + url: "https://github.com/traPtitech/anke-to" security: - application: - read @@ -30,22 +30,22 @@ paths: - questionnaire description: 与えられた条件を満たす20件以下のアンケートのリストを取得します. parameters: - - $ref: '#/components/parameters/sortInQuery' - - $ref: '#/components/parameters/searchInQuery' - - $ref: '#/components/parameters/pageInQuery' - - $ref: '#/components/parameters/nontargetedInQuery' + - $ref: "#/components/parameters/sortInQuery" + - $ref: "#/components/parameters/searchInQuery" + - $ref: "#/components/parameters/pageInQuery" + - $ref: "#/components/parameters/nontargetedInQuery" responses: - '200': + "200": description: 正常に取得できました。アンケートの配列を返します。 content: application/json: schema: - $ref: '#/components/schemas/QuestionnairesWithPageMax' - '400': + $ref: "#/components/schemas/QuestionnairesWithPageMax" + "400": description: 与えられた情報の形式が異なります - '500': + "500": description: アンケートを正常に取得できませんでした - '503': + "503": description: SQLの実行時間が3sを超えた場合。主に正規表現が原因。 post: operationId: postQuestionnaire @@ -57,39 +57,39 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/NewQuestionnaire' + $ref: "#/components/schemas/NewQuestionnaire" responses: - '201': + "201": description: 正常にアンケートを作成できました.作成されたアンケートを返します. content: application/json: schema: - $ref: '#/components/schemas/NewQuestionnaireResponse' - '400': + $ref: "#/components/schemas/NewQuestionnaireResponse" + "400": description: 与えられた情報の形式が異なります - '500': + "500": description: アンケートを正常に作成できませんでした - '/questionnaires/{questionnaireID}': + "/questionnaires/{questionnaireID}": get: operationId: getQuestionnaire tags: - questionnaire description: アンケートの情報を取得します。 parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" responses: - '200': + "200": description: 正常に取得できました。 content: application/json: schema: - $ref: '#/components/schemas/QuestionnaireByID' - '400': + $ref: "#/components/schemas/QuestionnaireByID" + "400": description: アンケートのIDが無効です - '404': + "404": description: アンケートが存在しません - '500': + "500": description: アンケートを正常に取得できませんでした patch: operationId: editQuestionnaire @@ -97,99 +97,99 @@ paths: - questionnaire description: アンケートの情報を変更します. parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/NewQuestionnaire' + $ref: "#/components/schemas/NewQuestionnaire" responses: - '200': + "200": description: 正常にアンケートを変更できました. - '400': + "400": description: アンケートのIDが無効です - '500': + "500": description: 正常にアンケートを変更できませんでした delete: - operationId: delteQuestionnaire + operationId: deleteQuestionnaire tags: - questionnaire description: アンケートを削除します. parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" responses: - '200': + "200": description: 正常にアンケートを削除できました. - '400': + "400": description: アンケートのIDが無効です - '500': + "500": description: アンケートの削除ができませんでした - '/questionnaires/{questionnaireID}/questions': + "/questionnaires/{questionnaireID}/questions": get: operationId: getQuestions tags: - questionnaire description: アンケートに含まれる質問のリストを取得します。 parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" responses: - '200': + "200": description: 正常に取得できました。 content: application/json: schema: type: array items: - $ref: '#/components/schemas/QuestionDetails' - '400': + $ref: "#/components/schemas/QuestionDetails" + "400": description: アンケートのIDが無効です - '500': + "500": description: 質問のリストを取得できませんでした post: operationId: PostQuestionByQuestionnaireID tags: - questionnaire parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" description: 新しい質問を作成します. requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/NewQuestion' + $ref: "#/components/schemas/NewQuestion" responses: - '201': + "201": description: 正常に質問を作成できました.作成された質問を返します. content: application/json: schema: - $ref: '#/components/schemas/Question' - '400': + $ref: "#/components/schemas/Question" + "400": description: 正常に作成できませんでした。リクエストが不正です。 - '500': + "500": description: 正常に作成できません。主に正規表現が原因。 - '/questions/{questionID}': + "/questions/{questionID}": patch: operationId: editQuestion tags: - question description: 質問を変更します. parameters: - - $ref: '#/components/parameters/questionIDInPath' + - $ref: "#/components/parameters/questionIDInPath" requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/NewQuestion' + $ref: "#/components/schemas/NewQuestion" responses: - '200': + "200": description: 正常に質問を変更できました. - '400': + "400": description: 正常に変更できませんでした。リクエストが不正です。 - '500': + "500": description: 正常に変更できませんでした。主に正規表現が原因。 delete: operationId: deleteQuestion @@ -197,11 +197,11 @@ paths: - question description: 質問を削除します. parameters: - - $ref: '#/components/parameters/questionIDInPath' + - $ref: "#/components/parameters/questionIDInPath" responses: - '200': + "200": description: 正常に質問を削除できました。 - '500': + "500": description: 正常に削除できませんでした。存在しない質問です。 /responses: post: @@ -214,42 +214,42 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PostResponse' + $ref: "#/components/schemas/PostResponse" responses: - '201': + "201": description: 正常に回答を作成できました.作成された回答を返します. content: application/json: schema: - $ref: '#/components/schemas/ResponseDetails' - '400': + $ref: "#/components/schemas/ResponseDetails" + "400": description: 与えられた情報の形式が異なります - '404': + "404": description: アンケートの回答の期限がきれたため回答が存在しません - '405': + "405": description: 回答期限が過ぎたため回答できません - '500': + "500": description: 正常に回答が作成できませんでした - '/responses/{responseID}': + "/responses/{responseID}": get: operationId: getResponses tags: - response description: あるresponseIDを持つ回答に含まれる全ての質問に対する自分の回答を取得します parameters: - - $ref: '#/components/parameters/responseIDInPath' + - $ref: "#/components/parameters/responseIDInPath" responses: - '200': + "200": description: 正常に取得できました。 content: application/json: schema: - $ref: '#/components/schemas/Response' - '400': + $ref: "#/components/schemas/Response" + "400": description: responseIDが数値に変換できませんでした - '404': + "404": description: アンケートの回答の期限がきれたため回答が存在しません - '500': + "500": description: responseIDを取得できませんでした patch: operationId: editResponse @@ -257,23 +257,23 @@ paths: - response description: 回答を変更します. parameters: - - $ref: '#/components/parameters/responseIDInPath' + - $ref: "#/components/parameters/responseIDInPath" requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/NewResponse' + $ref: "#/components/schemas/NewResponse" responses: - '200': + "200": description: 正常に回答を変更できました. - '400': + "400": description: 与えられた回答の情報が異なります - '404': + "404": description: アンケートの回答の期限がきれたため回答が存在しません - '405': + "405": description: 回答期限が過ぎたため回答できません - '500': + "500": description: responseIDを取得できませんでした delete: operationId: deleteResponse @@ -281,17 +281,17 @@ paths: - response description: 回答を削除します. parameters: - - $ref: '#/components/parameters/responseIDInPath' + - $ref: "#/components/parameters/responseIDInPath" responses: - '200': + "200": description: 正常に回答を削除できました. - '400': + "400": description: 与えられた回答の情報が異なります - '404': + "404": description: アンケートの回答の期限がきれたため回答が存在しません - '405': + "405": description: 回答期限が過ぎたため回答できません - '500': + "500": description: responseIDを取得できませんでした /users: get: @@ -301,14 +301,14 @@ paths: summary: 未実装 description: (botおよび除名されたユーザーを除く、全ての) ユーザーのtraQIDのリストを取得します。 responses: - '200': + "200": description: 正常に取得できました.ユーザーの配列を返します. content: application/json: schema: type: array items: - $ref: '#/components/schemas/User' + $ref: "#/components/schemas/User" /users/me: get: operationId: getUsersMe @@ -316,13 +316,13 @@ paths: - user description: 自分のユーザー情報を取得します responses: - '200': + "200": description: 正常に取得できました。 content: application/json: schema: - $ref: '#/components/schemas/Me' - '500': + $ref: "#/components/schemas/Me" + "500": description: Userが取得できませんでした /users/me/responses: get: @@ -331,36 +331,36 @@ paths: - user description: 自分のすべての回答のリストを取得します。 responses: - '200': + "200": description: 正常に取得できました。回答の配列を返します。 content: application/json: schema: type: array items: - $ref: '#/components/schemas/ResponseSummary' - '500': + $ref: "#/components/schemas/ResponseSummary" + "500": description: Userが取得できませんでした - '/users/me/responses/{questionnaireID}': + "/users/me/responses/{questionnaireID}": get: operationId: getMyResponsesByID tags: - user parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" description: 特定のquestionnaireIdを持つアンケートに対する自分のすべての回答のリストを取得します。 responses: - '200': + "200": description: 正常に取得できました。回答の配列を返します。 content: application/json: schema: type: array items: - $ref: '#/components/schemas/ResponseSummary' - '400': + $ref: "#/components/schemas/ResponseSummary" + "400": description: questionnaireIDの型が数値ではありません - '500': + "500": description: 回答のリストを取得できませんでした /users/me/targeted: get: @@ -369,40 +369,40 @@ paths: - user description: 自分が対象になっている アンケートのリストを取得します。 parameters: - - $ref: '#/components/parameters/sortInQuery' + - $ref: "#/components/parameters/sortInQuery" responses: - '200': + "200": description: 正常に取得できました。アンケートの配列を返します。 content: application/json: schema: type: array items: - $ref: '#/components/schemas/QuestionnaireMyTargeted' - '500': + $ref: "#/components/schemas/QuestionnaireMyTargeted" + "500": description: 自分のUserIDが取得できませんでした /users/{traQID}/targeted: get: - operationId: getTargettedQuestionnairesBytraQID + operationId: getTargetedQuestionnairesBytraQID tags: - user description: ユーザが対象になっているアンケートのリストを取得します。 parameters: - - $ref: '#/components/parameters/sortInQuery' - - $ref: '#/components/parameters/answeredInQuery' - - $ref: '#/components/parameters/traQIDInPath' + - $ref: "#/components/parameters/sortInQuery" + - $ref: "#/components/parameters/answeredInQuery" + - $ref: "#/components/parameters/traQIDInPath" responses: - '200': + "200": description: 正常に取得できました。アンケートの配列を返します。 content: application/json: schema: type: array items: - $ref: '#/components/schemas/QuestionnaireMyTargeted' - '400': + $ref: "#/components/schemas/QuestionnaireMyTargeted" + "400": description: 与えらえた情報の形式が異なります - '500': + "500": description: 対象となっているアンケートのリストを取得できませんでした /users/me/administrates: get: @@ -411,15 +411,15 @@ paths: - user description: 自分が管理者になっているアンケートのリストを取得します。 responses: - '200': + "200": description: 正常に取得できました。アンケートの配列を返します。 content: application/json: schema: type: array items: - $ref: '#/components/schemas/QuestionnaireMyAdministrates' - '500': + $ref: "#/components/schemas/QuestionnaireMyAdministrates" + "500": description: 自分が管理者となっているアンケートのリストを取得できませんでした /groups: get: @@ -429,37 +429,37 @@ paths: summary: 未実装 description: (全ての) グループのリストを取得します responses: - '200': + "200": description: 正常に取得できました.グループの配列を返します. content: application/json: schema: type: array items: - $ref: '#/components/schemas/Group' - '/results/{questionnaireID}': + $ref: "#/components/schemas/Group" + "/results/{questionnaireID}": get: operationId: getResults tags: - result parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' - - $ref: '#/components/parameters/responseSortInQuery' + - $ref: "#/components/parameters/questionnaireIDInPath" + - $ref: "#/components/parameters/responseSortInQuery" description: あるquestionnaireIDを持つアンケートの結果をすべて取得します。 responses: - '200': + "200": description: 正常に取得できました。アンケートの各質問に対する結果の配列を返します。 content: application/json: schema: type: array items: - $ref: '#/components/schemas/ResponseResult' - '400': + $ref: "#/components/schemas/ResponseResult" + "400": description: questionnaireIDの型を数値に変換できませんでした - '403': + "403": description: 結果を閲覧する権限がありません。 - '500': + "500": description: アンケートの回答の詳細情報一覧が取得できませんでした components: parameters: @@ -468,7 +468,7 @@ components: in: query description: 回答したもの(answered)か未回答のもの(unanswered)かを選別 schema: - $ref: '#/components/schemas/AnsweredType' + $ref: "#/components/schemas/AnsweredType" sortInQuery: name: sort in: query @@ -477,7 +477,7 @@ components: タイトルの降順 "-title", 更新日時が新しい "modified_at", 更新日時が古い "-modified_at" ) schema: - $ref: '#/components/schemas/SortType' + $ref: "#/components/schemas/SortType" responseSortInQuery: name: sort in: query @@ -486,7 +486,7 @@ components: タイトルの降順 "-title", 更新日時が新しい "modified_at", 更新日時が古い "-modified_at" ) schema: - $ref: '#/components/schemas/ResponseSortType' + $ref: "#/components/schemas/ResponseSortType" searchInQuery: name: search in: query @@ -604,11 +604,11 @@ components: type: string format: date-time res_shared_to: - $ref: '#/components/schemas/ResShareType' + $ref: "#/components/schemas/ResShareType" targets: - $ref: '#/components/schemas/Users' + $ref: "#/components/schemas/Users" administrators: - $ref: '#/components/schemas/Users' + $ref: "#/components/schemas/Users" required: - title - description @@ -618,7 +618,7 @@ components: - administrators NewQuestionnaireResponse: allOf: - - $ref: '#/components/schemas/QuestionnaireUser' + - $ref: "#/components/schemas/QuestionnaireUser" Questionnaire: type: object properties: @@ -641,7 +641,7 @@ components: type: string format: date-time res_shared_to: - $ref: '#/components/schemas/ResShareType' + $ref: "#/components/schemas/ResShareType" required: - questionnaireID - title @@ -653,7 +653,7 @@ components: - targets QuestionnaireForList: allOf: - - $ref: '#/components/schemas/Questionnaire' + - $ref: "#/components/schemas/Questionnaire" - type: object properties: is_targeted: @@ -672,36 +672,36 @@ components: questionnaires: type: array items: - $ref: '#/components/schemas/QuestionnaireForList' + $ref: "#/components/schemas/QuestionnaireForList" required: - page_max - questionnaires QuestionnaireByID: allOf: - - $ref: '#/components/schemas/QuestionnaireUser' + - $ref: "#/components/schemas/QuestionnaireUser" - type: object properties: respondents: - $ref: '#/components/schemas/Users' + $ref: "#/components/schemas/Users" required: - respondents QuestionnaireMyTargeted: allOf: - - $ref: '#/components/schemas/Questionnaire' - - type: object - properties: - responded_at: - type: string - format: date-time - has_response: - type: boolean - description: 回答済みあるいは下書きが存在する - required: - - responded_at - - has_response + - $ref: "#/components/schemas/Questionnaire" + - type: object + properties: + responded_at: + type: string + format: date-time + has_response: + type: boolean + description: 回答済みあるいは下書きが存在する + required: + - responded_at + - has_response QuestionnaireMyAdministrates: - allOf: - - $ref: '#/components/schemas/QuestionnaireUser' + allOf: + - $ref: "#/components/schemas/QuestionnaireUser" - type: object properties: all_responded: @@ -710,22 +710,22 @@ components: description: | 回答必須でない場合、またはすべてのターゲットが回答済みの場合、true を返す。それ以外はfalseを返す。 respondents: - $ref: '#/components/schemas/Users' + $ref: "#/components/schemas/Users" required: - all_responded - respondents QuestionnaireUser: allOf: - - $ref: '#/components/schemas/Questionnaire' - - type: object - properties: - targets: - $ref: '#/components/schemas/Users' - administrators: - $ref: '#/components/schemas/Users' - required: - - targets - - administrators + - $ref: "#/components/schemas/Questionnaire" + - type: object + properties: + targets: + $ref: "#/components/schemas/Users" + administrators: + $ref: "#/components/schemas/Users" + required: + - targets + - administrators QuestionType: type: string example: Text @@ -752,7 +752,7 @@ components: description: | アンケートの質問のうち、何問目か question_type: - $ref: '#/components/schemas/QuestionType' + $ref: "#/components/schemas/QuestionType" body: type: string example: 質問文 @@ -780,13 +780,13 @@ components: example: 5 regex_pattern: type: string - example: '' + example: "" min_bound: type: string - example: '' + example: "" max_bound: type: string - example: '' + example: "" required: - page_num - question_num @@ -800,38 +800,38 @@ components: - scale_max NewQuestion: allOf: - - $ref: '#/components/schemas/QuestionBase' - - type: object - properties: - questionnaireID: - type: integer - example: 1 - required: - - questionnaireID + - $ref: "#/components/schemas/QuestionBase" + - type: object + properties: + questionnaireID: + type: integer + example: 1 + required: + - questionnaireID Question: allOf: - - $ref: '#/components/schemas/NewQuestion' - - type: object - properties: - questionID: - type: integer - example: 1 - required: - - questionID + - $ref: "#/components/schemas/NewQuestion" + - type: object + properties: + questionID: + type: integer + example: 1 + required: + - questionID QuestionDetails: allOf: - - $ref: '#/components/schemas/QuestionBase' - - type: object - properties: - questionID: - type: integer - example: 1 - created_at: - type: string - format: date-time - required: - - questionID - - created_at + - $ref: "#/components/schemas/QuestionBase" + - type: object + properties: + questionID: + type: integer + example: 1 + created_at: + type: string + format: date-time + required: + - questionID + - created_at NewResponse: type: object properties: @@ -841,7 +841,7 @@ components: body: type: array items: - $ref: '#/components/schemas/ResponseBody' + $ref: "#/components/schemas/ResponseBody" submitted_at: type: string format: date-time @@ -858,7 +858,7 @@ components: body: type: array items: - $ref: '#/components/schemas/ResponseBody' + $ref: "#/components/schemas/ResponseBody" temporarily: type: boolean example: true @@ -871,7 +871,7 @@ components: - body Response: allOf: - - $ref: '#/components/schemas/NewResponse' + - $ref: "#/components/schemas/NewResponse" - type: object properties: modified_at: @@ -881,7 +881,7 @@ components: - modified_at ResponseDetails: allOf: - - $ref: '#/components/schemas/NewResponse' + - $ref: "#/components/schemas/NewResponse" - type: object properties: responseID: @@ -925,7 +925,7 @@ components: type: integer example: 1 question_type: - $ref: '#/components/schemas/QuestionType' + $ref: "#/components/schemas/QuestionType" response: type: string example: リマインダーBOTを作った話 @@ -939,18 +939,18 @@ components: - question_type ResponseResult: allOf: - - $ref: '#/components/schemas/Response' - - type: object - properties: - traqID: - type: string - example: lolico - responseID: - type: integer - example: 1 - required: - - traqID - - responseID + - $ref: "#/components/schemas/Response" + - type: object + properties: + traqID: + type: string + example: lolico + responseID: + type: integer + example: 1 + required: + - traqID + - responseID required: - submitted_at Users: @@ -1008,7 +1008,7 @@ components: members: type: array items: - $ref: '#/components/schemas/Users' + $ref: "#/components/schemas/Users" createdAt: type: string format: date-time @@ -1028,7 +1028,7 @@ components: type: oauth2 flows: clientCredentials: - tokenUrl: 'http://example.com/oauth/token' + tokenUrl: "http://example.com/oauth/token" scopes: write: allows modifying resources read: allows reading resources From 83f4173723f5d4bf27a7d169aa0626ccf5d400ae Mon Sep 17 00:00:00 2001 From: rei Date: Fri, 8 Dec 2023 11:07:23 +0900 Subject: [PATCH 02/77] =?UTF-8?q?=E5=90=84properties=E3=82=92=E5=94=AF?= =?UTF-8?q?=E4=B8=80=E3=81=AE=E8=A6=81=E7=B4=A0=E3=81=AB=E3=82=82=E3=81=A4?= =?UTF-8?q?schema=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 142 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 137 insertions(+), 5 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index ef313687..9b6a6251 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -953,11 +953,6 @@ components: - responseID required: - submitted_at - Users: - type: array - items: - type: string - example: lolico User: type: object properties: @@ -1023,6 +1018,143 @@ components: - members - createdAt - updatedAt + QuestionnaireID: + type: object + properties: + questionnaireID: + type: integer + example: 1 + required: + - questionnaireID + QuestionnaireTitle: + type: object + properties: + title: + type: string + example: 第1回集会らん☆ぷろ募集アンケート + required: + - title + QuestionnaireDescription: + type: object + properties: + description: + type: string + example: 第1回メンバー集会でのらん☆ぷろで発表したい人を募集します らん☆ぷろで発表したい人あつまれー! + required: + - description + QuestionnaireResponseDueDateTime: + type: object + properties: + response_due_date_time: + type: string + format: date-time + required: + - response_due_date_time + QuestionnaireResponseViewableBy: + type: object + properties: + response_viewable_by: + $ref: "#/components/schemas/ResShareType" + required: + - response_viewable_by + QuestionnaireIsAnonymous: + type: object + properties: + is_anonymous: + type: boolean + example: true + description: | + 匿名回答かどうか + required: + - is_anonymous + QuestionnaireAllowsMultipleResponses: + type: object + properties: + allows_multiple_responses: + type: boolean + example: true + description: | + 一人が複数回回答できるかどうか + required: + - allows_multiple_responses + QuestionnaireIsPublished: + type: object + properties: + is_published: + type: boolean + example: true + description: | + アンケートが公開されているかどうか + required: + - is_published + QuestionnaireCreatedAt: + type: object + properties: + created_at: + type: string + format: date-time + required: + - created_at + QuestionnaireModifiedAt: + type: object + properties: + modified_at: + type: string + format: date-time + required: + - modified_at + QuestionnaireTargets: + $ref: "#/components/schemas/UsersAndGroups" + QuestionnaireAdministrators: + $ref: "#/components/schemas/UsersAndGroups" + QuestionnaireAllResponded: + type: object + properties: + all_responded: + type: boolean + example: true + description: | + 回答必須でない場合、またはすべてのターゲットが回答済みの場合、true を返す。それ以外はfalseを返す。 + required: + - all_responded + QuestionnaireRespondents: + $ref: "#/components/schemas/Users" + QuestionnaireRespondedAt: + type: object + properties: + responded_at: + type: string + format: date-time + required: + - responded_at + QuestionnaireHasMyResponse: + type: object + properties: + has_response: + type: boolean + description: 回答済みあるいは下書きが存在する + required: + - has_response + UsersAndGroups: + type: object + properties: + users: + $ref: "#/components/schemas/Users" + groups: + $ref: "#/components/schemas/Groups" + required: + - users + - groups + Users: + type: array + items: + type: string + example: cp20 + Groups: + type: array + items: + type: string + example: executive24 securitySchemes: application: type: oauth2 From c911cf7bbfadb287f6839b3e498fbd08b4f57252 Mon Sep 17 00:00:00 2001 From: rei Date: Fri, 8 Dec 2023 11:16:01 +0900 Subject: [PATCH 03/77] =?UTF-8?q?NewQuestionnaire,=20NewQuestionnaireRespo?= =?UTF-8?q?nse=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 46 ++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 9b6a6251..3916448c 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -592,33 +592,22 @@ components: description: | アンケートの結果を, 運営は見られる ("administrators"), 回答済みの人は見られる ("respondents") 誰でも見られる ("public") NewQuestionnaire: - type: object - properties: - title: - type: string - example: 第1回集会らん☆ぷろ募集アンケート - description: - type: string - example: 第1回メンバー集会でのらん☆ぷろで発表したい人を募集します らん☆ぷろで発表したい人あつまれー! - res_time_limit: - type: string - format: date-time - res_shared_to: - $ref: "#/components/schemas/ResShareType" - targets: - $ref: "#/components/schemas/Users" - administrators: - $ref: "#/components/schemas/Users" - required: - - title - - description - - res_time_limit - - res_shared_to - - targets - - administrators + allOf: + - $ref: "#/components/schemas/QuestionnaireTitle" + - $ref: "#/components/schemas/QuestionnaireDescription" + - $ref: "#/components/schemas/QuestionnaireResponseDueDateTime" + - $ref: "#/components/schemas/QuestionnaireResponseViewableBy" + - $ref: "#/components/schemas/QuestionnaireIsAnonymous" + - $ref: "#/components/schemas/QuestionnaireAllowsMultipleResponses" + - $ref: "#/components/schemas/QuestionnaireIsPublished" + - $ref: "#/components/schemas/QuestionnaireTargets" + - $ref: "#/components/schemas/QuestionnaireAdministrators" + - $ref: "#/components/schemas/QuestionnaireQuestions" NewQuestionnaireResponse: allOf: - - $ref: "#/components/schemas/QuestionnaireUser" + - $ref: "#/components/schemas/Questionnaire" + - $ref: "#/components/schemas/QuestionnaireCreatedAt" + - $ref: "#/components/schemas/QuestionnaireModifiedAt" Questionnaire: type: object properties: @@ -1135,6 +1124,13 @@ components: description: 回答済みあるいは下書きが存在する required: - has_response + QuestionnaireQuestions: + type: object + properties: + questions: + type: array + items: + $ref: "#/components/schemas/Question" UsersAndGroups: type: object properties: From 918893c0f725d902c44081de4772ddcec4ecd7ff Mon Sep 17 00:00:00 2001 From: rei Date: Fri, 8 Dec 2023 12:03:53 +0900 Subject: [PATCH 04/77] =?UTF-8?q?=E5=90=84schema=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E6=88=90=E3=83=BB=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 75 +++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 43 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 3916448c..ac9b8817 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -591,6 +591,24 @@ components: - public description: | アンケートの結果を, 運営は見られる ("administrators"), 回答済みの人は見られる ("respondents") 誰でも見られる ("public") + QuestionnaireSummary: + allOf: + - $ref: "#/components/schemas/QuestionnaireID" + - $ref: "#/components/schemas/QuestionnaireTitle" + - $ref: "#/components/schemas/QuestionnaireDescription" + - $ref: "#/components/schemas/QuestionnaireResponseDueDateTime" + - $ref: "#/components/schemas/QuestionnaireResponseViewableBy" + - $ref: "#/components/schemas/QuestionnaireIsAnonymous" + - $ref: "#/components/schemas/QuestionnaireAllowsMultipleResponses" + - $ref: "#/components/schemas/QuestionnaireIsPublished" + - $ref: "#/components/schemas/QuestionnaireTargets" + - $ref: "#/components/schemas/QuestionnaireAdministrators" + QuestionnaireDetail: + allOf: + - $ref: "#/components/schemas/QuestionnaireID" + - $ref: "#/components/schemas/Questionnaire" + - $ref: "#/components/schemas/QuestionnaireCreatedAt" + - $ref: "#/components/schemas/QuestionnaireModifiedAt" NewQuestionnaire: allOf: - $ref: "#/components/schemas/QuestionnaireTitle" @@ -605,41 +623,21 @@ components: - $ref: "#/components/schemas/QuestionnaireQuestions" NewQuestionnaireResponse: allOf: + - $ref: "#/components/schemas/QuestionnaireID" - $ref: "#/components/schemas/Questionnaire" - $ref: "#/components/schemas/QuestionnaireCreatedAt" - $ref: "#/components/schemas/QuestionnaireModifiedAt" Questionnaire: - type: object - properties: - questionnaireID: - type: integer - example: 1 - title: - type: string - example: 第1回集会らん☆ぷろ募集アンケート - description: - type: string - example: 第1回メンバー集会でのらん☆ぷろで発表したい人を募集します らん☆ぷろで発表したい人あつまれー! - res_time_limit: - type: string - format: date-time - created_at: - type: string - format: date-time - modified_at: - type: string - format: date-time - res_shared_to: - $ref: "#/components/schemas/ResShareType" - required: - - questionnaireID - - title - - description - - res_time_limit - - created_at - - modified_at - - res_shared_to - - targets + allOf: + - $ref: "#/components/schemas/QuestionnaireID" + - $ref: "#/components/schemas/QuestionnaireTitle" + - $ref: "#/components/schemas/QuestionnaireDescription" + - $ref: "#/components/schemas/QuestionnaireResponseDueDateTime" + - $ref: "#/components/schemas/QuestionnaireResponseViewableBy" + - $ref: "#/components/schemas/QuestionnaireIsAnonymous" + - $ref: "#/components/schemas/QuestionnaireAllowsMultipleResponses" + - $ref: "#/components/schemas/QuestionnaireIsPublished" + - $ref: "#/components/schemas/QuestionnaireQuestions" QuestionnaireForList: allOf: - $ref: "#/components/schemas/Questionnaire" @@ -667,7 +665,7 @@ components: - questionnaires QuestionnaireByID: allOf: - - $ref: "#/components/schemas/QuestionnaireUser" + - $ref: "#/components/schemas/NewQuestionnaireResponse" - type: object properties: respondents: @@ -690,7 +688,7 @@ components: - has_response QuestionnaireMyAdministrates: allOf: - - $ref: "#/components/schemas/QuestionnaireUser" + - $ref: "#/components/schemas/NewQuestionnaireResponse" - type: object properties: all_responded: @@ -705,16 +703,7 @@ components: - respondents QuestionnaireUser: allOf: - - $ref: "#/components/schemas/Questionnaire" - - type: object - properties: - targets: - $ref: "#/components/schemas/Users" - administrators: - $ref: "#/components/schemas/Users" - required: - - targets - - administrators + - $ref: "#/components/schemas/NewQuestionnaireResponse" QuestionType: type: string example: Text From 0715cc10998baaf6813c5fe8d85d9b90c711b1e2 Mon Sep 17 00:00:00 2001 From: rei Date: Fri, 8 Dec 2023 18:34:28 +0900 Subject: [PATCH 05/77] =?UTF-8?q?parameter=E3=81=A8schema=E3=82=92?= =?UTF-8?q?=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 41 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index ac9b8817..ef1d33b4 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -33,7 +33,7 @@ paths: - $ref: "#/components/parameters/sortInQuery" - $ref: "#/components/parameters/searchInQuery" - $ref: "#/components/parameters/pageInQuery" - - $ref: "#/components/parameters/nontargetedInQuery" + - $ref: "#/components/parameters/isTargetingMeInQuery" responses: "200": description: 正常に取得できました。アンケートの配列を返します。 @@ -64,7 +64,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/NewQuestionnaireResponse" + $ref: "#/components/schemas/QuestionnaireDetail" "400": description: 与えられた情報の形式が異なります "500": @@ -499,8 +499,8 @@ components: description: 何ページ目か (未定義の場合は1ページ目) schema: type: integer - nontargetedInQuery: - name: nontargeted + isTargetingMeInQuery: + name: isTargetingMe in: query description: | 自分がターゲットになっていないもののみ取得 (true), ターゲットになっているものも含めてすべて取得 (false)。デフォルトはfalse。 @@ -591,24 +591,6 @@ components: - public description: | アンケートの結果を, 運営は見られる ("administrators"), 回答済みの人は見られる ("respondents") 誰でも見られる ("public") - QuestionnaireSummary: - allOf: - - $ref: "#/components/schemas/QuestionnaireID" - - $ref: "#/components/schemas/QuestionnaireTitle" - - $ref: "#/components/schemas/QuestionnaireDescription" - - $ref: "#/components/schemas/QuestionnaireResponseDueDateTime" - - $ref: "#/components/schemas/QuestionnaireResponseViewableBy" - - $ref: "#/components/schemas/QuestionnaireIsAnonymous" - - $ref: "#/components/schemas/QuestionnaireAllowsMultipleResponses" - - $ref: "#/components/schemas/QuestionnaireIsPublished" - - $ref: "#/components/schemas/QuestionnaireTargets" - - $ref: "#/components/schemas/QuestionnaireAdministrators" - QuestionnaireDetail: - allOf: - - $ref: "#/components/schemas/QuestionnaireID" - - $ref: "#/components/schemas/Questionnaire" - - $ref: "#/components/schemas/QuestionnaireCreatedAt" - - $ref: "#/components/schemas/QuestionnaireModifiedAt" NewQuestionnaire: allOf: - $ref: "#/components/schemas/QuestionnaireTitle" @@ -621,13 +603,13 @@ components: - $ref: "#/components/schemas/QuestionnaireTargets" - $ref: "#/components/schemas/QuestionnaireAdministrators" - $ref: "#/components/schemas/QuestionnaireQuestions" - NewQuestionnaireResponse: + QuestionnaireDetail: allOf: - $ref: "#/components/schemas/QuestionnaireID" - - $ref: "#/components/schemas/Questionnaire" + - $ref: "#/components/schemas/NewQuestionnaire" - $ref: "#/components/schemas/QuestionnaireCreatedAt" - $ref: "#/components/schemas/QuestionnaireModifiedAt" - Questionnaire: + QuestionnaireSummary: allOf: - $ref: "#/components/schemas/QuestionnaireID" - $ref: "#/components/schemas/QuestionnaireTitle" @@ -637,7 +619,6 @@ components: - $ref: "#/components/schemas/QuestionnaireIsAnonymous" - $ref: "#/components/schemas/QuestionnaireAllowsMultipleResponses" - $ref: "#/components/schemas/QuestionnaireIsPublished" - - $ref: "#/components/schemas/QuestionnaireQuestions" QuestionnaireForList: allOf: - $ref: "#/components/schemas/Questionnaire" @@ -659,13 +640,13 @@ components: questionnaires: type: array items: - $ref: "#/components/schemas/QuestionnaireForList" + $ref: "#/components/schemas/QuestionnaireSummary" required: - page_max - questionnaires QuestionnaireByID: allOf: - - $ref: "#/components/schemas/NewQuestionnaireResponse" + - $ref: "#/components/schemas/QuestionnaireDetail" - type: object properties: respondents: @@ -688,7 +669,7 @@ components: - has_response QuestionnaireMyAdministrates: allOf: - - $ref: "#/components/schemas/NewQuestionnaireResponse" + - $ref: "#/components/schemas/QuestionnaireDetail" - type: object properties: all_responded: @@ -703,7 +684,7 @@ components: - respondents QuestionnaireUser: allOf: - - $ref: "#/components/schemas/NewQuestionnaireResponse" + - $ref: "#/components/schemas/QuestionnaireDetail" QuestionType: type: string example: Text From 85d6e438369ad8603df3e5b5ed1d7d47ed1dd092 Mon Sep 17 00:00:00 2001 From: rei Date: Sat, 9 Dec 2023 12:13:28 +0900 Subject: [PATCH 06/77] =?UTF-8?q?question=E3=82=92=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 186 +++++++++++++++++++------------------- 1 file changed, 92 insertions(+), 94 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index ef1d33b4..6176b0b9 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -141,7 +141,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/QuestionDetails" + $ref: "#/components/schemas/Question" "400": description: アンケートのIDが無効です "500": @@ -621,7 +621,7 @@ components: - $ref: "#/components/schemas/QuestionnaireIsPublished" QuestionnaireForList: allOf: - - $ref: "#/components/schemas/Questionnaire" + - $ref: "#/components/schemas/QuestionnaireSummary" - type: object properties: is_targeted: @@ -655,7 +655,7 @@ components: - respondents QuestionnaireMyTargeted: allOf: - - $ref: "#/components/schemas/Questionnaire" + - $ref: "#/components/schemas/QuestionnaireSummary" - type: object properties: responded_at: @@ -685,103 +685,17 @@ components: QuestionnaireUser: allOf: - $ref: "#/components/schemas/QuestionnaireDetail" - QuestionType: - type: string - example: Text - enum: - - Text - - TextArea - - Number - - MultipleChoice - - Checkbox - - LinearScale - description: | - どのタイプの質問か ("Text", "TextArea", "Number", "MultipleChoice", "Checkbox", "LinearScale") - QuestionBase: - type: object - properties: - page_num: - type: integer - example: 1 - description: | - アンケートの何ページ目の質問か - question_num: - type: integer - example: 1 - description: | - アンケートの質問のうち、何問目か - question_type: - $ref: "#/components/schemas/QuestionType" - body: - type: string - example: 質問文 - is_required: - type: boolean - example: true - description: | - 回答必須かどうか - options: - type: array - items: - type: string - example: 選択肢1 - scale_label_right: - type: string - example: そう思わない - scale_label_left: - type: string - example: そう思う - scale_min: - type: integer - example: 1 - scale_max: - type: integer - example: 5 - regex_pattern: - type: string - example: "" - min_bound: - type: string - example: "" - max_bound: - type: string - example: "" - required: - - page_num - - question_num - - question_type - - body - - is_required - - options - - scale_label_right - - scale_label_left - - scale_min - - scale_max + + # TODO: exampleを追加する NewQuestion: allOf: - $ref: "#/components/schemas/QuestionBase" - - type: object - properties: - questionnaireID: - type: integer - example: 1 - required: - - questionnaireID + - $ref: "#/components/schemas/QuestionSettingsByType" Question: - allOf: - - $ref: "#/components/schemas/NewQuestion" - - type: object - properties: - questionID: - type: integer - example: 1 - required: - - questionID - QuestionDetails: allOf: - $ref: "#/components/schemas/QuestionBase" - - type: object - properties: + - $ref: "#/components/schemas/QuestionSettingsByType" + - properties: questionID: type: integer example: 1 @@ -791,6 +705,89 @@ components: required: - questionID - created_at + Questions: + type: array + items: + $ref: "#/components/schemas/Question" + QuestionBase: + type: object + properties: + questionnaireID: + type: integer + example: 1 + questionType: + $ref: "#/components/schemas/QuestionType" + title: + type: string + description: + type: string + is_required: + type: boolean + required: + - questionType + - title + - description + - is_required + - questionnaireID + QuestionSettingsByType: + oneOf: + - $ref: "#/components/schemas/QuestionSettingsText" + - $ref: "#/components/schemas/QuestionSettingsTextLong" + - $ref: "#/components/schemas/QuestionSettingsNumber" + - $ref: "#/components/schemas/QuestionSettingsSingleChoice" + - $ref: "#/components/schemas/QuestionSettingsMultipleChoice" + - $ref: "#/components/schemas/QuestionSettingsScale" + QuestionSettingsText: + type: object + properties: + maxLength: + type: integer + QuestionSettingsTextLong: + type: object + properties: + maxLength: + type: number + QuestionSettingsNumber: + type: object + properties: + minValue: + type: integer + maxValue: + type: integer + QuestionSettingsSingleChoice: + type: object + properties: + options: + type: array + items: + type: string + QuestionSettingsMultipleChoice: + type: object + properties: + options: + type: array + items: + type: string + QuestionSettingsScale: + type: object + properties: + minValue: + type: integer + maxValue: + type: integer + QuestionType: + type: string + example: Text + enum: + - Text + - TextArea + - Number + - MultipleChoice + - Checkbox + - LinearScale + description: | + どのタイプの質問か ("Text", "TextLong", "Number", "SingleChoice", "MultipleChoice", "Scale") + NewResponse: type: object properties: @@ -1121,6 +1118,7 @@ components: items: type: string example: executive24 + securitySchemes: application: type: oauth2 From 64d72c6a48c1339a9baf2fbe178dea2376a8a568 Mon Sep 17 00:00:00 2001 From: rei Date: Sat, 9 Dec 2023 13:06:50 +0900 Subject: [PATCH 07/77] =?UTF-8?q?QuestionnaireList=E3=81=AB=E7=B5=B1?= =?UTF-8?q?=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 104 ++++++++++++-------------------------- 1 file changed, 32 insertions(+), 72 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 6176b0b9..543e74ad 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -40,7 +40,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/QuestionnairesWithPageMax" + $ref: "#/components/schemas/QuestionnaireList" "400": description: 与えられた情報の形式が異なります "500": @@ -84,7 +84,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/QuestionnaireByID" + $ref: "#/components/schemas/QuestionnaireList" "400": description: アンケートのIDが無効です "404": @@ -378,7 +378,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/QuestionnaireMyTargeted" + $ref: "#/components/schemas/QuestionnaireList" "500": description: 自分のUserIDが取得できませんでした /users/{traQID}/targeted: @@ -399,7 +399,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/QuestionnaireMyTargeted" + $ref: "#/components/schemas/QuestionnaireList" "400": description: 与えらえた情報の形式が異なります "500": @@ -418,7 +418,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/QuestionnaireMyAdministrates" + $ref: "#/components/schemas/QuestionnaireList" "500": description: 自分が管理者となっているアンケートのリストを取得できませんでした /groups: @@ -586,11 +586,11 @@ components: type: string example: public enum: - - administrators + - admins - respondents - public description: | - アンケートの結果を, 運営は見られる ("administrators"), 回答済みの人は見られる ("respondents") 誰でも見られる ("public") + アンケートの結果を, 運営は見られる ("admins"), 回答済みの人は見られる ("respondents") 誰でも見られる ("public") NewQuestionnaire: allOf: - $ref: "#/components/schemas/QuestionnaireTitle" @@ -600,13 +600,13 @@ components: - $ref: "#/components/schemas/QuestionnaireIsAnonymous" - $ref: "#/components/schemas/QuestionnaireAllowsMultipleResponses" - $ref: "#/components/schemas/QuestionnaireIsPublished" - - $ref: "#/components/schemas/QuestionnaireTargets" - - $ref: "#/components/schemas/QuestionnaireAdministrators" - - $ref: "#/components/schemas/QuestionnaireQuestions" + - $ref: "#/components/schemas/QuestionnaireTargetsAndAdmins" + - $ref: "#/components/schemas/Questions" QuestionnaireDetail: allOf: - $ref: "#/components/schemas/QuestionnaireID" - $ref: "#/components/schemas/NewQuestionnaire" + - $ref: "#/components/schemas/QuestionnaireRespondents" - $ref: "#/components/schemas/QuestionnaireCreatedAt" - $ref: "#/components/schemas/QuestionnaireModifiedAt" QuestionnaireSummary: @@ -619,72 +619,36 @@ components: - $ref: "#/components/schemas/QuestionnaireIsAnonymous" - $ref: "#/components/schemas/QuestionnaireAllowsMultipleResponses" - $ref: "#/components/schemas/QuestionnaireIsPublished" - QuestionnaireForList: - allOf: - - $ref: "#/components/schemas/QuestionnaireSummary" - - type: object - properties: - is_targeted: + - properties: + is_targeting_me: type: boolean example: true description: | 自分がターゲットになっているかどうか - required: - - is_targeted - QuestionnairesWithPageMax: - type: object - properties: - page_max: - type: integer - description: 最大ページ数 - questionnaires: - type: array - items: - $ref: "#/components/schemas/QuestionnaireSummary" - required: - - page_max - - questionnaires - QuestionnaireByID: - allOf: - - $ref: "#/components/schemas/QuestionnaireDetail" - - type: object - properties: - respondents: - $ref: "#/components/schemas/Users" - required: - - respondents - QuestionnaireMyTargeted: - allOf: - - $ref: "#/components/schemas/QuestionnaireSummary" - - type: object - properties: responded_at: type: string format: date-time - has_response: + has_my_draft: type: boolean - description: 回答済みあるいは下書きが存在する - required: - - responded_at - - has_response - QuestionnaireMyAdministrates: - allOf: - - $ref: "#/components/schemas/QuestionnaireDetail" - - type: object - properties: + description: 下書きが存在する + has_my_response: + type: boolean + description: 回答が存在する all_responded: type: boolean example: true description: | 回答必須でない場合、またはすべてのターゲットが回答済みの場合、true を返す。それ以外はfalseを返す。 - respondents: - $ref: "#/components/schemas/Users" required: + - is_targeting_me + - responded_at + - has_my_draft + - has_my_response - all_responded - - respondents - QuestionnaireUser: - allOf: - - $ref: "#/components/schemas/QuestionnaireDetail" + QuestionnaireList: + type: array + items: + $ref: "#/components/schemas/QuestionnaireSummary" # TODO: exampleを追加する NewQuestion: @@ -1059,10 +1023,13 @@ components: format: date-time required: - modified_at - QuestionnaireTargets: - $ref: "#/components/schemas/UsersAndGroups" - QuestionnaireAdministrators: - $ref: "#/components/schemas/UsersAndGroups" + QuestionnaireTargetsAndAdmins: + type: object + properties: + targets: + $ref: "#/components/schemas/UsersAndGroups" + admins: + $ref: "#/components/schemas/UsersAndGroups" QuestionnaireAllResponded: type: object properties: @@ -1091,13 +1058,6 @@ components: description: 回答済みあるいは下書きが存在する required: - has_response - QuestionnaireQuestions: - type: object - properties: - questions: - type: array - items: - $ref: "#/components/schemas/Question" UsersAndGroups: type: object properties: From d8b1073a49166817d518a020786ac97e361bc34e Mon Sep 17 00:00:00 2001 From: rei Date: Sat, 9 Dec 2023 13:07:42 +0900 Subject: [PATCH 08/77] =?UTF-8?q?CodeSpellChecker=E3=81=AEsettings.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..faddaff5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "cSpell.words": [ + "anke", + "Bytra", + "lolico", + "mazrean", + "trapyojo", + "traq", + "varnames" + ] +} From 9f65511922cb99e5dc49eb6b3449723e1d3303f7 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 16:39:56 +0900 Subject: [PATCH 09/77] =?UTF-8?q?questions=E3=82=92=E5=8F=96=E5=BE=97?= =?UTF-8?q?=E3=81=99=E3=82=8BAPI=E3=82=92=E5=89=8A=E9=99=A4=20response?= =?UTF-8?q?=E3=82=92=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 507 ++++++++++++++------------------------ 1 file changed, 190 insertions(+), 317 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 543e74ad..4ac3923e 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -84,7 +84,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/QuestionnaireList" + $ref: "#/components/schemas/QuestionnaireDetail" "400": description: アンケートのIDが無効です "404": @@ -103,7 +103,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/NewQuestionnaire" + $ref: "#/components/schemas/QuestionnaireDetail" responses: "200": description: 正常にアンケートを変更できました. @@ -125,84 +125,6 @@ paths: description: アンケートのIDが無効です "500": description: アンケートの削除ができませんでした - "/questionnaires/{questionnaireID}/questions": - get: - operationId: getQuestions - tags: - - questionnaire - description: アンケートに含まれる質問のリストを取得します。 - parameters: - - $ref: "#/components/parameters/questionnaireIDInPath" - responses: - "200": - description: 正常に取得できました。 - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Question" - "400": - description: アンケートのIDが無効です - "500": - description: 質問のリストを取得できませんでした - post: - operationId: PostQuestionByQuestionnaireID - tags: - - questionnaire - parameters: - - $ref: "#/components/parameters/questionnaireIDInPath" - description: 新しい質問を作成します. - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/NewQuestion" - responses: - "201": - description: 正常に質問を作成できました.作成された質問を返します. - content: - application/json: - schema: - $ref: "#/components/schemas/Question" - "400": - description: 正常に作成できませんでした。リクエストが不正です。 - "500": - description: 正常に作成できません。主に正規表現が原因。 - "/questions/{questionID}": - patch: - operationId: editQuestion - tags: - - question - description: 質問を変更します. - parameters: - - $ref: "#/components/parameters/questionIDInPath" - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/NewQuestion" - responses: - "200": - description: 正常に質問を変更できました. - "400": - description: 正常に変更できませんでした。リクエストが不正です。 - "500": - description: 正常に変更できませんでした。主に正規表現が原因。 - delete: - operationId: deleteQuestion - tags: - - question - description: 質問を削除します. - parameters: - - $ref: "#/components/parameters/questionIDInPath" - responses: - "200": - description: 正常に質問を削除できました。 - "500": - description: 正常に削除できませんでした。存在しない質問です。 /responses: post: operationId: postResponse @@ -214,14 +136,14 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PostResponse" + $ref: "#/components/schemas/Response" responses: "201": description: 正常に回答を作成できました.作成された回答を返します. content: application/json: schema: - $ref: "#/components/schemas/ResponseDetails" + $ref: "#/components/schemas/Response" "400": description: 与えられた情報の形式が異なります "404": @@ -263,7 +185,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/NewResponse" + $ref: "#/components/schemas/Response" responses: "200": description: 正常に回答を変更できました. @@ -338,7 +260,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/ResponseSummary" + $ref: "#/components/schemas/Response" "500": description: Userが取得できませんでした "/users/me/responses/{questionnaireID}": @@ -357,7 +279,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/ResponseSummary" + $ref: "#/components/schemas/Response" "400": description: questionnaireIDの型が数値ではありません "500": @@ -454,7 +376,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/ResponseResult" + $ref: "#/components/schemas/Response" "400": description: questionnaireIDの型を数値に変換できませんでした "403": @@ -538,7 +460,7 @@ components: traQ ID(ex:mazrean) schema: type: string - schemas: + schemas: # TODO: description, example, requiredを確認する AnsweredType: type: string description: アンケート検索時に回答済みかの状態での絞り込み @@ -584,13 +506,13 @@ components: - ModifiedAtDESC ResShareType: type: string - example: public + example: anyone enum: - admins - respondents - - public + - anyone description: | - アンケートの結果を, 運営は見られる ("admins"), 回答済みの人は見られる ("respondents") 誰でも見られる ("public") + アンケートの結果を, 運営は見られる ("admins"), 回答済みの人は見られる ("respondents") 誰でも見られる ("anyone") NewQuestionnaire: allOf: - $ref: "#/components/schemas/QuestionnaireTitle" @@ -649,8 +571,127 @@ components: type: array items: $ref: "#/components/schemas/QuestionnaireSummary" + QuestionnaireID: + type: object + properties: + questionnaireID: + type: integer + example: 1 + required: + - questionnaireID + QuestionnaireTitle: + type: object + properties: + title: + type: string + example: 第1回集会らん☆ぷろ募集アンケート + required: + - title + QuestionnaireDescription: + type: object + properties: + description: + type: string + example: 第1回メンバー集会でのらん☆ぷろで発表したい人を募集します らん☆ぷろで発表したい人あつまれー! + required: + - description + QuestionnaireResponseDueDateTime: + type: object + properties: + response_due_date_time: + type: string + format: date-time + required: + - response_due_date_time + QuestionnaireResponseViewableBy: + type: object + properties: + response_viewable_by: + $ref: "#/components/schemas/ResShareType" + required: + - response_viewable_by + QuestionnaireIsAnonymous: + type: object + properties: + is_anonymous: + type: boolean + example: true + description: | + 匿名回答かどうか + required: + - is_anonymous + QuestionnaireAllowsMultipleResponses: + type: object + properties: + allows_multiple_responses: + type: boolean + example: true + description: | + 一人が複数回回答できるかどうか + required: + - allows_multiple_responses + QuestionnaireIsPublished: + type: object + properties: + is_published: + type: boolean + example: true + description: | + アンケートが公開されているかどうか + required: + - is_published + QuestionnaireCreatedAt: + type: object + properties: + created_at: + type: string + format: date-time + required: + - created_at + QuestionnaireModifiedAt: + type: object + properties: + modified_at: + type: string + format: date-time + required: + - modified_at + QuestionnaireTargetsAndAdmins: + type: object + properties: + targets: + $ref: "#/components/schemas/UsersAndGroups" + admins: + $ref: "#/components/schemas/UsersAndGroups" + QuestionnaireAllResponded: + type: object + properties: + all_responded: + type: boolean + example: true + description: | + 回答必須でない場合、またはすべてのターゲットが回答済みの場合、true を返す。それ以外はfalseを返す。 + required: + - all_responded + QuestionnaireRespondents: + $ref: "#/components/schemas/Users" + QuestionnaireRespondedAt: + type: object + properties: + responded_at: + type: string + format: date-time + required: + - responded_at + QuestionnaireHasMyResponse: + type: object + properties: + has_response: + type: boolean + description: 回答済みあるいは下書きが存在する + required: + - has_response - # TODO: exampleを追加する NewQuestion: allOf: - $ref: "#/components/schemas/QuestionBase" @@ -744,135 +785,83 @@ components: example: Text enum: - Text - - TextArea + - TextLong - Number + - SingleChoice - MultipleChoice - - Checkbox - - LinearScale + - Scale description: | - どのタイプの質問か ("Text", "TextLong", "Number", "SingleChoice", "MultipleChoice", "Scale") + どのタイプの質問か - NewResponse: + Response: type: object properties: - questionnaireID: - type: integer - example: 1 - body: - type: array - items: - $ref: "#/components/schemas/ResponseBody" + respondent: + type: string + example: lolico + is_draft: + type: boolean + example: true submitted_at: type: string format: date-time - required: - - temporarily - - questionnaireID - - body - PostResponse: - type: object - properties: - questionnaireID: - type: integer - example: 1 + modified_at: + type: string + format: date-time body: type: array items: $ref: "#/components/schemas/ResponseBody" - temporarily: - type: boolean - example: true - submitted_at: - type: string - format: date-time required: - - temporarily - - questionnaireID + - respondent + - is_draft + - submitted_at + - modified_at - body - Response: - allOf: - - $ref: "#/components/schemas/NewResponse" - - type: object - properties: - modified_at: - type: string - format: date-time - required: - - modified_at - ResponseDetails: - allOf: - - $ref: "#/components/schemas/NewResponse" - - type: object - properties: - responseID: - type: integer - example: 1 - required: - - responseID - ResponseSummary: + ResponseBody: + oneOf: + - $ref: "#/components/schemas/ResponseSettingsText" + - $ref: "#/components/schemas/ResponseSettingsTextLong" + - $ref: "#/components/schemas/ResponseSettingsNumber" + - $ref: "#/components/schemas/ResponseSettingsSingleChoice" + - $ref: "#/components/schemas/ResponseSettingsMultipleChoice" + - $ref: "#/components/schemas/ResponseSettingsScale" + ResponseSettingsText: type: object properties: - responseID: - type: integer - example: 1 - questionnaireID: - type: integer - example: 1 - questionnaire_title: - type: string - example: 第1回集会らん☆ぷろ募集アンケート - description: - type: string - example: 2017年度入学学部生 - res_time_limit: + text: type: string - format: date-time - submitted_at: - type: string - format: date-time - modified_at: + ResponseSettingsTextLong: + type: object + properties: + text: type: string - format: date-time - required: - - responseID - - questionnaireID - - questionnaire_title - - modified_at - ResponseBody: + ResponseSettingsNumber: type: object properties: - questionID: + number: + type: number + ResponseSettingsSingleChoice: + type: object + properties: + index: type: integer - example: 1 - question_type: - $ref: "#/components/schemas/QuestionType" - response: - type: string - example: リマインダーBOTを作った話 - option_response: + description: | + 選択肢のインデックス + ResponseSettingsMultipleChoice: + type: object + properties: + answerIndexes: type: array items: - type: string - example: 選択肢1 - required: - - questionID - - question_type - ResponseResult: - allOf: - - $ref: "#/components/schemas/Response" - - type: object - properties: - traqID: - type: string - example: lolico - responseID: - type: integer - example: 1 - required: - - traqID - - responseID - required: - - submitted_at + type: integer + description: | + 選択肢のインデックスの配列 + ResponseSettingsScale: + type: object + properties: + number: + type: integer User: type: object properties: @@ -938,126 +927,6 @@ components: - members - createdAt - updatedAt - QuestionnaireID: - type: object - properties: - questionnaireID: - type: integer - example: 1 - required: - - questionnaireID - QuestionnaireTitle: - type: object - properties: - title: - type: string - example: 第1回集会らん☆ぷろ募集アンケート - required: - - title - QuestionnaireDescription: - type: object - properties: - description: - type: string - example: 第1回メンバー集会でのらん☆ぷろで発表したい人を募集します らん☆ぷろで発表したい人あつまれー! - required: - - description - QuestionnaireResponseDueDateTime: - type: object - properties: - response_due_date_time: - type: string - format: date-time - required: - - response_due_date_time - QuestionnaireResponseViewableBy: - type: object - properties: - response_viewable_by: - $ref: "#/components/schemas/ResShareType" - required: - - response_viewable_by - QuestionnaireIsAnonymous: - type: object - properties: - is_anonymous: - type: boolean - example: true - description: | - 匿名回答かどうか - required: - - is_anonymous - QuestionnaireAllowsMultipleResponses: - type: object - properties: - allows_multiple_responses: - type: boolean - example: true - description: | - 一人が複数回回答できるかどうか - required: - - allows_multiple_responses - QuestionnaireIsPublished: - type: object - properties: - is_published: - type: boolean - example: true - description: | - アンケートが公開されているかどうか - required: - - is_published - QuestionnaireCreatedAt: - type: object - properties: - created_at: - type: string - format: date-time - required: - - created_at - QuestionnaireModifiedAt: - type: object - properties: - modified_at: - type: string - format: date-time - required: - - modified_at - QuestionnaireTargetsAndAdmins: - type: object - properties: - targets: - $ref: "#/components/schemas/UsersAndGroups" - admins: - $ref: "#/components/schemas/UsersAndGroups" - QuestionnaireAllResponded: - type: object - properties: - all_responded: - type: boolean - example: true - description: | - 回答必須でない場合、またはすべてのターゲットが回答済みの場合、true を返す。それ以外はfalseを返す。 - required: - - all_responded - QuestionnaireRespondents: - $ref: "#/components/schemas/Users" - QuestionnaireRespondedAt: - type: object - properties: - responded_at: - type: string - format: date-time - required: - - responded_at - QuestionnaireHasMyResponse: - type: object - properties: - has_response: - type: boolean - description: 回答済みあるいは下書きが存在する - required: - - has_response UsersAndGroups: type: object properties: @@ -1073,11 +942,15 @@ components: items: type: string example: cp20 + description: | + traQ ID Groups: type: array items: type: string - example: executive24 + example: 1 + description: | + Group UUID securitySchemes: application: From 0da27fcf20a91c4d871f9b2b42f5a4d0eb135464 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 17:57:43 +0900 Subject: [PATCH 10/77] =?UTF-8?q?result=20schema=E3=81=AE=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=20API=E3=81=AE=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 210 ++++++++++++++++++++++++++++++-------- 1 file changed, 165 insertions(+), 45 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 4ac3923e..7653a06e 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -23,7 +23,7 @@ tags: - name: group - name: result paths: - /questionnaires: + /questionnaires: # TODO: 取得個数可変でもいいかも get: operationId: getQuestionnaires tags: @@ -69,8 +69,7 @@ paths: description: 与えられた情報の形式が異なります "500": description: アンケートを正常に作成できませんでした - - "/questionnaires/{questionnaireID}": + /questionnaires/{questionnaireID}: get: operationId: getQuestionnaire tags: @@ -125,18 +124,40 @@ paths: description: アンケートのIDが無効です "500": description: アンケートの削除ができませんでした - /responses: + /questionnaires/{questionnaireID}/responses: + get: + operationId: getQuestionnaireResponses + tags: + - questionnaire + description: アンケートの全ての回答を取得します。アンケートが匿名回答の場合、取得できません。 + parameters: + - $ref: "#/components/parameters/questionnaireIDInPath" + responses: + "200": + description: 正常に取得できました。 + content: + application/json: + schema: + $ref: "#/components/schemas/Responses" + "400": + description: アンケートのIDが無効です + "403": + description: アンケートが匿名回答のため回答を取得できません + "404": + description: アンケートが存在しません + "500": + description: 回答を正常に取得できませんでした post: - operationId: postResponse + operationId: postQuestionnaireResponse tags: - - response - description: 新しい回答を作成します. + - questionnaire + description: 新しい回答を作成します。アンケートが複数回答可能でない場合、過去の回答が削除されます。 requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/Response" + $ref: "#/components/schemas/NewResponse" responses: "201": description: 正常に回答を作成できました.作成された回答を返します. @@ -152,12 +173,35 @@ paths: description: 回答期限が過ぎたため回答できません "500": description: 正常に回答が作成できませんでした - "/responses/{responseID}": + /questionnaires/{questionnaireID}/result: + get: + operationId: getQuestionnaireResult + tags: + - questionnaire + description: アンケートの回答を集計した結果を取得します。回答者の情報は含まれず、アンケートが匿名回答であっても取得できます。 + parameters: + - $ref: "#/components/parameters/questionnaireIDInPath" + responses: + "200": + description: 正常に取得できました。 + content: + application/json: + schema: + $ref: "#/components/schemas/Result" + "400": + description: アンケートのIDが無効です + "403": + description: 結果を閲覧する権限がありません。 + "404": + description: アンケートが存在しません + "500": + description: アンケートの結果を正常に取得できませんでした + /responses/{responseID}: get: operationId: getResponses tags: - response - description: あるresponseIDを持つ回答に含まれる全ての質問に対する自分の回答を取得します + description: あるresponseIDを持つ回答に含まれる全ての質問に対する自分の回答を取得します。 parameters: - $ref: "#/components/parameters/responseIDInPath" responses: @@ -169,6 +213,8 @@ paths: $ref: "#/components/schemas/Response" "400": description: responseIDが数値に変換できませんでした + "403": + description: 回答を閲覧する権限がありません。 "404": description: アンケートの回答の期限がきれたため回答が存在しません "500": @@ -191,6 +237,8 @@ paths: description: 正常に回答を変更できました. "400": description: 与えられた回答の情報が異なります + "403": + description: 回答を変更する権限がありません。 "404": description: アンケートの回答の期限がきれたため回答が存在しません "405": @@ -209,10 +257,12 @@ paths: description: 正常に回答を削除できました. "400": description: 与えられた回答の情報が異なります + "403": + description: 回答を削除する権限がありません。 "404": description: アンケートの回答の期限がきれたため回答が存在しません "405": - description: 回答期限が過ぎたため回答できません + description: 回答期限が過ぎたため回答を削除できません "500": description: responseIDを取得できませんでした /users: @@ -231,6 +281,8 @@ paths: type: array items: $ref: "#/components/schemas/User" + "500": + description: ユーザーのリストを取得できませんでした /users/me: get: operationId: getUsersMe @@ -260,10 +312,10 @@ paths: schema: type: array items: - $ref: "#/components/schemas/Response" + $ref: "#/components/schemas/Responses" "500": description: Userが取得できませんでした - "/users/me/responses/{questionnaireID}": + /users/me/responses/{questionnaireID}: get: operationId: getMyResponsesByID tags: @@ -359,30 +411,6 @@ paths: type: array items: $ref: "#/components/schemas/Group" - "/results/{questionnaireID}": - get: - operationId: getResults - tags: - - result - parameters: - - $ref: "#/components/parameters/questionnaireIDInPath" - - $ref: "#/components/parameters/responseSortInQuery" - description: あるquestionnaireIDを持つアンケートの結果をすべて取得します。 - responses: - "200": - description: 正常に取得できました。アンケートの各質問に対する結果の配列を返します。 - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Response" - "400": - description: questionnaireIDの型を数値に変換できませんでした - "403": - description: 結果を閲覧する権限がありません。 - "500": - description: アンケートの回答の詳細情報一覧が取得できませんでした components: parameters: answeredInQuery: @@ -691,7 +719,6 @@ components: description: 回答済みあるいは下書きが存在する required: - has_response - NewQuestion: allOf: - $ref: "#/components/schemas/QuestionBase" @@ -792,10 +819,12 @@ components: - Scale description: | どのタイプの質問か - - Response: + NewResponse: type: object properties: + questionnaireID: + type: integer + example: 1 respondent: type: string example: lolico @@ -813,11 +842,26 @@ components: items: $ref: "#/components/schemas/ResponseBody" required: + - questionnaireID - respondent - is_draft - submitted_at - modified_at - body + Response: + allOf: + - type: object + properties: + responseID: + type: integer + example: 1 + required: + - responseID + - $ref: "#/components/schemas/NewResponse" + Responses: + type: array + items: + $ref: "#/components/schemas/Response" ResponseBody: oneOf: - $ref: "#/components/schemas/ResponseSettingsText" @@ -834,7 +878,7 @@ components: ResponseSettingsTextLong: type: object properties: - text: + textLong: type: string ResponseSettingsNumber: type: object @@ -862,10 +906,87 @@ components: properties: number: type: integer + Result: + type: object + properties: + questionnaireID: + type: integer + example: 1 + responseNum: + type: integer + example: 1 + body: + type: array + items: + $ref: "#/components/schemas/ResponseBody" + ResultBody: + oneOf: + - $ref: "#/components/schemas/ResponseSettingsText" + - $ref: "#/components/schemas/ResponseSettingsTextLong" + - $ref: "#/components/schemas/ResponseSettingsNumber" + - $ref: "#/components/schemas/ResponseSettingsSingleChoice" + - $ref: "#/components/schemas/ResponseSettingsMultipleChoice" + - $ref: "#/components/schemas/ResponseSettingsScale" + ResultSettingsText: + type: object + properties: + texts: + type: array + items: + type: string + description: | + 回答文の配列 + ResultSettingsTextLong: + type: object + properties: + textLongs: + type: array + items: + type: string + description: | + 回答文の配列 + ResultSettingsNumber: + type: object + properties: + number: + type: array + items: + type: array + items: + type: number + description: | + 値ごとの回答数の配列 + ResultSettingsSingleChoice: + type: object + properties: + index: + type: array + items: + type: array + items: + type: number + description: | + 選択肢ごとの回答数の配列 + ResultSettingsMultipleChoice: + type: object + properties: + answerIndexes: + type: array + items: + type: array + items: + type: number + description: | + 選択肢ごとの回答数の配列 + ResultSettingsScale: + type: object + properties: + number: + type: integer User: type: object properties: - userId: + userUUID: type: string format: uuid traqID: @@ -881,7 +1002,7 @@ components: type: string example: trapyojo required: - - userId + - userUUID - traqID - displayName - iconFileId @@ -897,7 +1018,7 @@ components: Group: type: object properties: - groupId: + groupUUID: type: string format: uuid name: @@ -951,7 +1072,6 @@ components: example: 1 description: | Group UUID - securitySchemes: application: type: oauth2 From f865ad9ae89952c7a01df086f781298142da6a5f Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 18:00:20 +0900 Subject: [PATCH 11/77] =?UTF-8?q?tag=E3=81=8B=E3=82=89question=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 7653a06e..8e01b0cf 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -17,7 +17,6 @@ security: - write tags: - name: questionnaire - - name: question - name: response - name: user - name: group From d5460ec20da63bf8032bf8f741bd15dd5c2fbb7d Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 19:04:17 +0900 Subject: [PATCH 12/77] =?UTF-8?q?NewQuestionnaire=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 8e01b0cf..9993ec5b 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -550,7 +550,11 @@ components: - $ref: "#/components/schemas/QuestionnaireAllowsMultipleResponses" - $ref: "#/components/schemas/QuestionnaireIsPublished" - $ref: "#/components/schemas/QuestionnaireTargetsAndAdmins" - - $ref: "#/components/schemas/Questions" + - properties: + questions: + type: array + items: + $ref: "#/components/schemas/NewQuestion" QuestionnaireDetail: allOf: - $ref: "#/components/schemas/QuestionnaireID" From 47f321766b8847456786b96689c25bbe3dcb1aa4 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 19:19:04 +0900 Subject: [PATCH 13/77] =?UTF-8?q?isAdministratedByMe=E3=83=91=E3=83=A9?= =?UTF-8?q?=E3=83=A1=E3=83=BC=E3=82=BF=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 9993ec5b..4987039c 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -33,6 +33,7 @@ paths: - $ref: "#/components/parameters/searchInQuery" - $ref: "#/components/parameters/pageInQuery" - $ref: "#/components/parameters/isTargetingMeInQuery" + - $ref: "#/components/parameters/isAdministratedByMeInQuery" responses: "200": description: 正常に取得できました。アンケートの配列を返します。 @@ -455,6 +456,13 @@ components: 自分がターゲットになっていないもののみ取得 (true), ターゲットになっているものも含めてすべて取得 (false)。デフォルトはfalse。 schema: type: boolean + isAdministratedByMeInQuery: + name: isAdministratedByMe + in: query + description: | + 自分が管理者になっていないもののみ取得 (true), 管理者になっているものも含めてすべて取得 (false)。デフォルトはfalse。 + schema: + type: boolean questionnaireIDInPath: name: questionnaireID in: path From 05d32742dceedb7ad78ee9f72b0af1e9965e6ff6 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 19:21:31 +0900 Subject: [PATCH 14/77] /responses/MyResponse --- docs/swagger/swagger.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 4987039c..f516716e 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -265,6 +265,25 @@ paths: description: 回答期限が過ぎたため回答を削除できません "500": description: responseIDを取得できませんでした + /responses/MyResponse: + get: + operationId: getMyResponses + tags: + - response + description: 自分のすべての回答のリストを取得します。 + parameters: + - $ref: "#/components/parameters/sortInQuery" + responses: + "200": + description: 正常に取得できました。回答の配列を返します。 + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Response" + "500": + description: 自分の回答のリストを取得できませんでした /users: get: operationId: getUsers From 56fefd5c972b15114e4f40ba6fe71a2fa51dcaf6 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 19:27:13 +0900 Subject: [PATCH 15/77] =?UTF-8?q?userAPI=E3=81=A8groupAPI=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 218 +------------------------------------- 1 file changed, 2 insertions(+), 216 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index f516716e..7ed6062f 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -18,10 +18,7 @@ security: tags: - name: questionnaire - name: response - - name: user - - name: group - - name: result -paths: +paths: #TODO: tagの整理 /questionnaires: # TODO: 取得個数可変でもいいかも get: operationId: getQuestionnaires @@ -265,7 +262,7 @@ paths: description: 回答期限が過ぎたため回答を削除できません "500": description: responseIDを取得できませんでした - /responses/MyResponse: + /responses/MyResponses: get: operationId: getMyResponses tags: @@ -284,152 +281,6 @@ paths: $ref: "#/components/schemas/Response" "500": description: 自分の回答のリストを取得できませんでした - /users: - get: - operationId: getUsers - tags: - - user - summary: 未実装 - description: (botおよび除名されたユーザーを除く、全ての) ユーザーのtraQIDのリストを取得します。 - responses: - "200": - description: 正常に取得できました.ユーザーの配列を返します. - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/User" - "500": - description: ユーザーのリストを取得できませんでした - /users/me: - get: - operationId: getUsersMe - tags: - - user - description: 自分のユーザー情報を取得します - responses: - "200": - description: 正常に取得できました。 - content: - application/json: - schema: - $ref: "#/components/schemas/Me" - "500": - description: Userが取得できませんでした - /users/me/responses: - get: - operationId: getMyResponses - tags: - - user - description: 自分のすべての回答のリストを取得します。 - responses: - "200": - description: 正常に取得できました。回答の配列を返します。 - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Responses" - "500": - description: Userが取得できませんでした - /users/me/responses/{questionnaireID}: - get: - operationId: getMyResponsesByID - tags: - - user - parameters: - - $ref: "#/components/parameters/questionnaireIDInPath" - description: 特定のquestionnaireIdを持つアンケートに対する自分のすべての回答のリストを取得します。 - responses: - "200": - description: 正常に取得できました。回答の配列を返します。 - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Response" - "400": - description: questionnaireIDの型が数値ではありません - "500": - description: 回答のリストを取得できませんでした - /users/me/targeted: - get: - operationId: getTargetedQuestionnaire - tags: - - user - description: 自分が対象になっている アンケートのリストを取得します。 - parameters: - - $ref: "#/components/parameters/sortInQuery" - responses: - "200": - description: 正常に取得できました。アンケートの配列を返します。 - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/QuestionnaireList" - "500": - description: 自分のUserIDが取得できませんでした - /users/{traQID}/targeted: - get: - operationId: getTargetedQuestionnairesBytraQID - tags: - - user - description: ユーザが対象になっているアンケートのリストを取得します。 - parameters: - - $ref: "#/components/parameters/sortInQuery" - - $ref: "#/components/parameters/answeredInQuery" - - $ref: "#/components/parameters/traQIDInPath" - responses: - "200": - description: 正常に取得できました。アンケートの配列を返します。 - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/QuestionnaireList" - "400": - description: 与えらえた情報の形式が異なります - "500": - description: 対象となっているアンケートのリストを取得できませんでした - /users/me/administrates: - get: - operationId: getMyQuestionnaire - tags: - - user - description: 自分が管理者になっているアンケートのリストを取得します。 - responses: - "200": - description: 正常に取得できました。アンケートの配列を返します。 - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/QuestionnaireList" - "500": - description: 自分が管理者となっているアンケートのリストを取得できませんでした - /groups: - get: - operationId: getGroups - tags: - - group - summary: 未実装 - description: (全ての) グループのリストを取得します - responses: - "200": - description: 正常に取得できました.グループの配列を返します. - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Group" components: parameters: answeredInQuery: @@ -1013,71 +864,6 @@ components: properties: number: type: integer - User: - type: object - properties: - userUUID: - type: string - format: uuid - traqID: - type: string - example: lolico - displayName: - type: string - example: ロリ子 - iconFileId: - type: string - format: uuid - twitterId: - type: string - example: trapyojo - required: - - userUUID - - traqID - - displayName - - iconFileId - - twitterId - Me: - type: object - properties: - traqID: - type: string - example: lolico - required: - - traqID - Group: - type: object - properties: - groupUUID: - type: string - format: uuid - name: - type: string - example: 17B - description: - type: string - example: 2017年度入学学部生 - adminUser: - type: string - example: lolico - members: - type: array - items: - $ref: "#/components/schemas/Users" - createdAt: - type: string - format: date-time - updatedAt: - type: string - format: date-time - required: - - groupId - - name - - description - - adminUser - - members - - createdAt - - updatedAt UsersAndGroups: type: object properties: From 5c294a6fdfdb948e681d99e5ce68521a97e5a5a6 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 19:30:28 +0900 Subject: [PATCH 16/77] =?UTF-8?q?.gitignore=E3=81=AB.vscode/settings.json?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index fa996640..e0647f3b 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ mock_* *.png # End of https://www.gitignore.io/api/go + +.vscode/settings.json \ No newline at end of file From 04a7a1ffc92fef08d1a221d0ee65c086ab5a4069 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 19:46:55 +0900 Subject: [PATCH 17/77] =?UTF-8?q?review=E3=81=AB=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?=E3=81=97=E3=81=9F=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 7ed6062f..c1f9751b 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -157,7 +157,7 @@ paths: #TODO: tagの整理 $ref: "#/components/schemas/NewResponse" responses: "201": - description: 正常に回答を作成できました.作成された回答を返します. + description: 正常に回答を作成できました。作成された回答を返します。 content: application/json: schema: @@ -166,7 +166,7 @@ paths: #TODO: tagの整理 description: 与えられた情報の形式が異なります "404": description: アンケートの回答の期限がきれたため回答が存在しません - "405": + "422": description: 回答期限が過ぎたため回答できません "500": description: 正常に回答が作成できませんでした @@ -195,10 +195,10 @@ paths: #TODO: tagの整理 description: アンケートの結果を正常に取得できませんでした /responses/{responseID}: get: - operationId: getResponses + operationId: getResponse tags: - response - description: あるresponseIDを持つ回答に含まれる全ての質問に対する自分の回答を取得します。 + description: 回答を取得します。 parameters: - $ref: "#/components/parameters/responseIDInPath" responses: @@ -209,18 +209,18 @@ paths: #TODO: tagの整理 schema: $ref: "#/components/schemas/Response" "400": - description: responseIDが数値に変換できませんでした + description: responseIDが無効です "403": description: 回答を閲覧する権限がありません。 "404": - description: アンケートの回答の期限がきれたため回答が存在しません + description: 回答が存在しません "500": - description: responseIDを取得できませんでした + description: 回答を正常に取得できませんでした patch: operationId: editResponse tags: - response - description: 回答を変更します. + description: 回答を変更します。 parameters: - $ref: "#/components/parameters/responseIDInPath" requestBody: @@ -231,11 +231,11 @@ paths: #TODO: tagの整理 $ref: "#/components/schemas/Response" responses: "200": - description: 正常に回答を変更できました. + description: 正常に回答を変更できました "400": description: 与えられた回答の情報が異なります "403": - description: 回答を変更する権限がありません。 + description: 回答を変更する権限がありません "404": description: アンケートの回答の期限がきれたため回答が存在しません "405": @@ -246,12 +246,12 @@ paths: #TODO: tagの整理 operationId: deleteResponse tags: - response - description: 回答を削除します. + description: 回答を削除します parameters: - $ref: "#/components/parameters/responseIDInPath" responses: "200": - description: 正常に回答を削除できました. + description: 正常に回答を削除できました "400": description: 与えられた回答の情報が異なります "403": @@ -323,7 +323,7 @@ components: name: isTargetingMe in: query description: | - 自分がターゲットになっていないもののみ取得 (true), ターゲットになっているものも含めてすべて取得 (false)。デフォルトはfalse。 + 自分がターゲットになっているもののみ取得 (true), ターゲットになっているものも含めてすべて取得 (false)。デフォルトはfalse。 schema: type: boolean isAdministratedByMeInQuery: From fd1293fa0489d02aab02e94dbcec1cc7d1f44805 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 19:49:25 +0900 Subject: [PATCH 18/77] =?UTF-8?q?settings.json=E3=81=AE=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index faddaff5..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "cSpell.words": [ - "anke", - "Bytra", - "lolico", - "mazrean", - "trapyojo", - "traq", - "varnames" - ] -} From e923df56a267e558442b6a607b3fd470904472f9 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 19:53:44 +0900 Subject: [PATCH 19/77] =?UTF-8?q?review=E3=81=AB=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?=E3=81=97=E3=81=9F=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index c1f9751b..85698c2b 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -165,7 +165,7 @@ paths: #TODO: tagの整理 "400": description: 与えられた情報の形式が異なります "404": - description: アンケートの回答の期限がきれたため回答が存在しません + description: アンケートが存在しません "422": description: 回答期限が過ぎたため回答できません "500": From acc0100a33d8ca2455053709f4b215265cce2cf6 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 19:57:32 +0900 Subject: [PATCH 20/77] =?UTF-8?q?page=5Fmax=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 85698c2b..ad14d80f 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -477,9 +477,17 @@ components: - has_my_response - all_responded QuestionnaireList: - type: array - items: - $ref: "#/components/schemas/QuestionnaireSummary" + type: object + properties: + page_max: + type: integer + example: 1 + description: | + ページ数 + questionnaires: + type: array + items: + $ref: "#/components/schemas/QuestionnaireSummary" QuestionnaireID: type: object properties: From e501f7ed09d8488c57867b78f8a3e1aec5ad1c59 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 20:24:10 +0900 Subject: [PATCH 21/77] =?UTF-8?q?review=E3=81=AB=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?=E3=81=97=E3=81=9F=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index ad14d80f..91a81a09 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -24,7 +24,7 @@ paths: #TODO: tagの整理 operationId: getQuestionnaires tags: - questionnaire - description: 与えられた条件を満たす20件以下のアンケートのリストを取得します. + description: 与えられた条件を満たす20件以下のアンケートのリストを取得します。 parameters: - $ref: "#/components/parameters/sortInQuery" - $ref: "#/components/parameters/searchInQuery" @@ -48,7 +48,7 @@ paths: #TODO: tagの整理 operationId: postQuestionnaire tags: - questionnaire - description: 新しいアンケートを作成します. + description: 新しいアンケートを作成します。 requestBody: required: true content: @@ -57,7 +57,7 @@ paths: #TODO: tagの整理 $ref: "#/components/schemas/NewQuestionnaire" responses: "201": - description: 正常にアンケートを作成できました.作成されたアンケートを返します. + description: 正常にアンケートを作成できました。作成されたアンケートを返します。 content: application/json: schema: @@ -91,7 +91,7 @@ paths: #TODO: tagの整理 operationId: editQuestionnaire tags: - questionnaire - description: アンケートの情報を変更します. + description: アンケートの情報を変更します。 parameters: - $ref: "#/components/parameters/questionnaireIDInPath" requestBody: @@ -102,7 +102,7 @@ paths: #TODO: tagの整理 $ref: "#/components/schemas/QuestionnaireDetail" responses: "200": - description: 正常にアンケートを変更できました. + description: 正常にアンケートを変更できました。 "400": description: アンケートのIDが無効です "500": @@ -111,12 +111,12 @@ paths: #TODO: tagの整理 operationId: deleteQuestionnaire tags: - questionnaire - description: アンケートを削除します. + description: アンケートを削除します。 parameters: - $ref: "#/components/parameters/questionnaireIDInPath" responses: "200": - description: 正常にアンケートを削除できました. + description: 正常にアンケートを削除できました。 "400": description: アンケートのIDが無効です "500": @@ -278,7 +278,7 @@ paths: #TODO: tagの整理 schema: type: array items: - $ref: "#/components/schemas/Response" + $ref: "#/components/schemas/Responses" "500": description: 自分の回答のリストを取得できませんでした components: @@ -711,9 +711,6 @@ components: NewResponse: type: object properties: - questionnaireID: - type: integer - example: 1 respondent: type: string example: lolico @@ -739,6 +736,7 @@ components: - body Response: allOf: + - $ref: "#/components/schemas/QuestionnaireID" - type: object properties: responseID: From 834f6831e7577cc123da524a9d08df144ecf26b4 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 20:32:20 +0900 Subject: [PATCH 22/77] =?UTF-8?q?/users/me/responses/{questionnaireID}?= =?UTF-8?q?=E3=81=AB=E5=AF=BE=E5=BF=9C=E3=81=99=E3=82=8BAPI=E3=82=92?= =?UTF-8?q?=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 91a81a09..f83d0ae3 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -18,7 +18,7 @@ security: tags: - name: questionnaire - name: response -paths: #TODO: tagの整理 +paths: /questionnaires: # TODO: 取得個数可変でもいいかも get: operationId: getQuestionnaires @@ -129,6 +129,8 @@ paths: #TODO: tagの整理 description: アンケートの全ての回答を取得します。アンケートが匿名回答の場合、取得できません。 parameters: - $ref: "#/components/parameters/questionnaireIDInPath" + - $ref: "#/components/parameters/responseSortInQuery" + - $ref: "#/components/parameters/isMyResponseInQuery" responses: "200": description: 正常に取得できました。 @@ -269,7 +271,7 @@ paths: #TODO: tagの整理 - response description: 自分のすべての回答のリストを取得します。 parameters: - - $ref: "#/components/parameters/sortInQuery" + - $ref: "#/components/parameters/responseSortInQuery" responses: "200": description: 正常に取得できました。回答の配列を返します。 @@ -333,6 +335,13 @@ components: 自分が管理者になっていないもののみ取得 (true), 管理者になっているものも含めてすべて取得 (false)。デフォルトはfalse。 schema: type: boolean + isMyResponseInQuery: + name: isMyResponse + in: query + description: | + 自分の回答のみ取得 (true), 自分の回答以外も含めてすべて取得 (false)。デフォルトはfalse。 + schema: + type: boolean questionnaireIDInPath: name: questionnaireID in: path From 5ea32994d7a76db338207dff483b10a26f0c3b23 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 10 Dec 2023 20:35:25 +0900 Subject: [PATCH 23/77] =?UTF-8?q?result=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index f83d0ae3..c0574558 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -814,7 +814,7 @@ components: body: type: array items: - $ref: "#/components/schemas/ResponseBody" + $ref: "#/components/schemas/ResultBody" ResultBody: oneOf: - $ref: "#/components/schemas/ResponseSettingsText" From 347c3b96de7be2dfefbee87e4ad75ad0b8ac1bc2 Mon Sep 17 00:00:00 2001 From: rei Date: Mon, 11 Dec 2023 01:00:04 +0900 Subject: [PATCH 24/77] =?UTF-8?q?review=E3=81=AB=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?=E3=81=97=E3=81=9F=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 45 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index c0574558..37e8f1a5 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -29,8 +29,8 @@ paths: - $ref: "#/components/parameters/sortInQuery" - $ref: "#/components/parameters/searchInQuery" - $ref: "#/components/parameters/pageInQuery" - - $ref: "#/components/parameters/isTargetingMeInQuery" - - $ref: "#/components/parameters/isAdministratedByMeInQuery" + - $ref: "#/components/parameters/onlyTargetingMeInQuery" + - $ref: "#/components/parameters/onlyAdministratedByMeInQuery" responses: "200": description: 正常に取得できました。アンケートの配列を返します。 @@ -130,7 +130,7 @@ paths: parameters: - $ref: "#/components/parameters/questionnaireIDInPath" - $ref: "#/components/parameters/responseSortInQuery" - - $ref: "#/components/parameters/isMyResponseInQuery" + - $ref: "#/components/parameters/onlyMyResponseInQuery" responses: "200": description: 正常に取得できました。 @@ -321,21 +321,21 @@ components: description: 何ページ目か (未定義の場合は1ページ目) schema: type: integer - isTargetingMeInQuery: + onlyTargetingMeInQuery: name: isTargetingMe in: query description: | 自分がターゲットになっているもののみ取得 (true), ターゲットになっているものも含めてすべて取得 (false)。デフォルトはfalse。 schema: type: boolean - isAdministratedByMeInQuery: + onlyAdministratedByMeInQuery: name: isAdministratedByMe in: query description: | 自分が管理者になっていないもののみ取得 (true), 管理者になっているものも含めてすべて取得 (false)。デフォルトはfalse。 schema: type: boolean - isMyResponseInQuery: + onlyMyResponseInQuery: name: isMyResponse in: query description: | @@ -492,7 +492,7 @@ components: type: integer example: 1 description: | - ページ数 + 合計のページ数 questionnaires: type: array items: @@ -589,6 +589,9 @@ components: $ref: "#/components/schemas/UsersAndGroups" admins: $ref: "#/components/schemas/UsersAndGroups" + required: + - targets + - admins QuestionnaireAllResponded: type: object properties: @@ -596,19 +599,11 @@ components: type: boolean example: true description: | - 回答必須でない場合、またはすべてのターゲットが回答済みの場合、true を返す。それ以外はfalseを返す。 + すべての対象者が回答済みの場合 true を返す。それ以外は false を返す。 (対象者が存在しない場合は true を返す) required: - all_responded QuestionnaireRespondents: $ref: "#/components/schemas/Users" - QuestionnaireRespondedAt: - type: object - properties: - responded_at: - type: string - format: date-time - required: - - responded_at QuestionnaireHasMyResponse: type: object properties: @@ -691,6 +686,8 @@ components: type: array items: type: string + required: + - options QuestionSettingsMultipleChoice: type: object properties: @@ -698,6 +695,8 @@ components: type: array items: type: string + required: + - options QuestionSettingsScale: type: object properties: @@ -808,7 +807,7 @@ components: questionnaireID: type: integer example: 1 - responseNum: + responseCount: type: integer example: 1 body: @@ -817,12 +816,12 @@ components: $ref: "#/components/schemas/ResultBody" ResultBody: oneOf: - - $ref: "#/components/schemas/ResponseSettingsText" - - $ref: "#/components/schemas/ResponseSettingsTextLong" - - $ref: "#/components/schemas/ResponseSettingsNumber" - - $ref: "#/components/schemas/ResponseSettingsSingleChoice" - - $ref: "#/components/schemas/ResponseSettingsMultipleChoice" - - $ref: "#/components/schemas/ResponseSettingsScale" + - $ref: "#/components/schemas/ResultSettingsText" + - $ref: "#/components/schemas/ResultSettingsTextLong" + - $ref: "#/components/schemas/ResultSettingsNumber" + - $ref: "#/components/schemas/ResultSettingsSingleChoice" + - $ref: "#/components/schemas/ResultSettingsMultipleChoice" + - $ref: "#/components/schemas/ResultSettingsScale" ResultSettingsText: type: object properties: From 0d84aa4dd26c026a71c88f38015071b0ed8bf492 Mon Sep 17 00:00:00 2001 From: rei Date: Mon, 11 Dec 2023 16:15:47 +0900 Subject: [PATCH 25/77] =?UTF-8?q?review=E3=81=AB=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?=E3=81=97=E3=81=9F=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 37e8f1a5..1124f315 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -151,6 +151,8 @@ paths: tags: - questionnaire description: 新しい回答を作成します。アンケートが複数回答可能でない場合、過去の回答が削除されます。 + parameters: + - $ref: "#/components/parameters/questionnaireIDInPath" requestBody: required: true content: @@ -434,7 +436,7 @@ components: - $ref: "#/components/schemas/QuestionnaireResponseDueDateTime" - $ref: "#/components/schemas/QuestionnaireResponseViewableBy" - $ref: "#/components/schemas/QuestionnaireIsAnonymous" - - $ref: "#/components/schemas/QuestionnaireAllowsMultipleResponses" + - $ref: "#/components/schemas/QuestionnaireIsAllowingMultipleResponses" - $ref: "#/components/schemas/QuestionnaireIsPublished" - $ref: "#/components/schemas/QuestionnaireTargetsAndAdmins" - properties: @@ -457,7 +459,7 @@ components: - $ref: "#/components/schemas/QuestionnaireResponseDueDateTime" - $ref: "#/components/schemas/QuestionnaireResponseViewableBy" - $ref: "#/components/schemas/QuestionnaireIsAnonymous" - - $ref: "#/components/schemas/QuestionnaireAllowsMultipleResponses" + - $ref: "#/components/schemas/QuestionnaireIsAllowingMultipleResponses" - $ref: "#/components/schemas/QuestionnaireIsPublished" - properties: is_targeting_me: @@ -546,16 +548,16 @@ components: 匿名回答かどうか required: - is_anonymous - QuestionnaireAllowsMultipleResponses: + QuestionnaireIsAllowingMultipleResponses: type: object properties: - allows_multiple_responses: + is_allowing_multiple_responses: type: boolean example: true description: | 一人が複数回回答できるかどうか required: - - allows_multiple_responses + - is_allowing_multiple_responses QuestionnaireIsPublished: type: object properties: From 1c00927c8beb6a845816d617b949440a252feac3 Mon Sep 17 00:00:00 2001 From: cp20 <47262658+cp-20@users.noreply.github.com> Date: Mon, 11 Dec 2023 21:50:50 +0900 Subject: [PATCH 26/77] Update docs/swagger/swagger.yaml (authorization) --- docs/swagger/swagger.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 1124f315..16000ec6 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -902,7 +902,8 @@ components: items: type: string example: 1 - description: | + authorizationUrl: "https://q.trap.jp/api/v3/oauth2/authorize" + tokenUrl: "https://q.trap.jp/api/v3/oauth2/token" Group UUID securitySchemes: application: From 77960a71b78b3784d5f9bf0d9ed805fa9b9da7cb Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 12:33:52 +0900 Subject: [PATCH 27/77] =?UTF-8?q?[docs]=20swagger.yaml=20required=E3=81=AE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20description=E3=81=AE=E4=BF=AE=E6=AD=A3=20Q?= =?UTF-8?q?uestionnaireAllResponded=E3=81=AE=E5=89=8A=E9=99=A4=20QuestionT?= =?UTF-8?q?ype=E3=81=AE=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 362 +++++++++++++++++++++++++------------- 1 file changed, 235 insertions(+), 127 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 16000ec6..4ff5762c 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -429,6 +429,7 @@ components: - anyone description: | アンケートの結果を, 運営は見られる ("admins"), 回答済みの人は見られる ("respondents") 誰でも見られる ("anyone") + NewQuestionnaire: allOf: - $ref: "#/components/schemas/QuestionnaireTitle" @@ -444,6 +445,8 @@ components: type: array items: $ref: "#/components/schemas/NewQuestion" + required: + - questions QuestionnaireDetail: allOf: - $ref: "#/components/schemas/QuestionnaireID" @@ -480,7 +483,7 @@ components: type: boolean example: true description: | - 回答必須でない場合、またはすべてのターゲットが回答済みの場合、true を返す。それ以外はfalseを返す。 + すべての対象者が回答済みの場合 true を返す。それ以外は false を返す。 (対象者が存在しない場合は true を返す) required: - is_targeting_me - responded_at @@ -499,6 +502,9 @@ components: type: array items: $ref: "#/components/schemas/QuestionnaireSummary" + required: + - page_max + - questionnaires QuestionnaireID: type: object properties: @@ -594,16 +600,6 @@ components: required: - targets - admins - QuestionnaireAllResponded: - type: object - properties: - all_responded: - type: boolean - example: true - description: | - すべての対象者が回答済みの場合 true を返す。それ以外は false を返す。 (対象者が存在しない場合は true を返す) - required: - - all_responded QuestionnaireRespondents: $ref: "#/components/schemas/Users" QuestionnaireHasMyResponse: @@ -642,8 +638,6 @@ components: questionnaireID: type: integer example: 1 - questionType: - $ref: "#/components/schemas/QuestionType" title: type: string description: @@ -665,59 +659,70 @@ components: - $ref: "#/components/schemas/QuestionSettingsMultipleChoice" - $ref: "#/components/schemas/QuestionSettingsScale" QuestionSettingsText: - type: object - properties: - maxLength: - type: integer + allOf: + - $ref: "#/components/schemas/QuestionTypeText" + - type: object + properties: + maxLength: + type: integer + required: + - maxLength QuestionSettingsTextLong: - type: object - properties: - maxLength: - type: number + allOf: + - $ref: "#/components/schemas/QuestionTypeTextLong" + - type: object + properties: + maxLength: + type: number + required: + - maxLength QuestionSettingsNumber: - type: object - properties: - minValue: - type: integer - maxValue: - type: integer + allOf: + - $ref: "#/components/schemas/QuestionTypeNumber" + - type: object + properties: + minValue: + type: integer + maxValue: + type: integer + required: + - minValue + - maxValue QuestionSettingsSingleChoice: - type: object - properties: - options: - type: array - items: - type: string - required: - - options + allOf: + - $ref: "#/components/schemas/QuestionTypeSingleChoice" + - type: object + properties: + options: + type: array + items: + type: string + required: + - options QuestionSettingsMultipleChoice: - type: object - properties: - options: - type: array - items: - type: string - required: - - options + allOf: + - $ref: "#/components/schemas/QuestionTypeMultipleChoice" + - type: object + properties: + options: + type: array + items: + type: string + required: + - options QuestionSettingsScale: - type: object - properties: - minValue: - type: integer - maxValue: - type: integer - QuestionType: - type: string - example: Text - enum: - - Text - - TextLong - - Number - - SingleChoice - - MultipleChoice - - Scale - description: | - どのタイプの質問か + allOf: + - $ref: "#/components/schemas/QuestionTypeScale" + - type: object + properties: + minValue: + type: integer + maxValue: + type: integer + required: + - minValue + - maxValue + NewResponse: type: object properties: @@ -738,7 +743,6 @@ components: items: $ref: "#/components/schemas/ResponseBody" required: - - questionnaireID - respondent - is_draft - submitted_at @@ -768,41 +772,113 @@ components: - $ref: "#/components/schemas/ResponseSettingsMultipleChoice" - $ref: "#/components/schemas/ResponseSettingsScale" ResponseSettingsText: + allOf: + - $ref: "#/components/schemas/QuestionTypeText" + - type: object + properties: + text: + type: string + required: + - text + ResponseSettingsTextLong: + allOf: + - $ref: "#/components/schemas/QuestionTypeTextLong" + - type: object + properties: + textLong: + type: string + required: + - textLong + ResponseSettingsNumber: + allOf: + - $ref: "#/components/schemas/QuestionTypeNumber" + - type: object + properties: + number: + type: number + required: + - number + ResponseSettingsSingleChoice: + allOf: + - $ref: "#/components/schemas/QuestionTypeSingleChoice" + - type: object + properties: + index: + type: integer + description: | + 選択肢のインデックス + required: + - index + ResponseSettingsMultipleChoice: + allOf: + - $ref: "#/components/schemas/QuestionTypeMultipleChoice" + - type: object + properties: + indexes: + type: array + items: + type: integer + description: | + 選択肢のインデックスの配列 + required: + - indexes + ResponseSettingsScale: + allOf: + - $ref: "#/components/schemas/QuestionTypeScale" + - type: object + properties: + number: + type: integer + required: + - number + QuestionTypeText: type: object properties: - text: + questionType: type: string - ResponseSettingsTextLong: + enum: [Text] + required: + - questionType + QuestionTypeTextLong: type: object properties: - textLong: + questionType: type: string - ResponseSettingsNumber: + enum: [TextLong] + required: + - questionType + QuestionTypeNumber: type: object properties: - number: - type: number - ResponseSettingsSingleChoice: + questionType: + type: string + enum: [Number] + required: + - questionType + QuestionTypeSingleChoice: type: object properties: - index: - type: integer - description: | - 選択肢のインデックス - ResponseSettingsMultipleChoice: + questionType: + type: string + enum: [SingleChoice] + required: + - questionType + QuestionTypeMultipleChoice: type: object properties: - answerIndexes: - type: array - items: - type: integer - description: | - 選択肢のインデックスの配列 - ResponseSettingsScale: + questionType: + type: string + enum: [MultipleChoice] + required: + - questionType + QuestionTypeScale: type: object properties: - number: - type: integer + questionType: + type: string + enum: [Scale] + required: + - questionType Result: type: object properties: @@ -816,6 +892,10 @@ components: type: array items: $ref: "#/components/schemas/ResultBody" + required: + - questionnaireID + - responseCount + - body ResultBody: oneOf: - $ref: "#/components/schemas/ResultSettingsText" @@ -825,61 +905,89 @@ components: - $ref: "#/components/schemas/ResultSettingsMultipleChoice" - $ref: "#/components/schemas/ResultSettingsScale" ResultSettingsText: - type: object - properties: - texts: - type: array - items: - type: string - description: | - 回答文の配列 + allOf: + - $ref: "#/components/schemas/QuestionTypeText" + - type: object + properties: + answers: + type: array + items: + type: string + description: | + 回答文の配列 + required: + - texts ResultSettingsTextLong: - type: object - properties: - textLongs: - type: array - items: - type: string - description: | - 回答文の配列 + allOf: + - $ref: "#/components/schemas/QuestionTypeTextLong" + - type: object + properties: + answers: + type: array + items: + type: string + description: | + 回答文の配列 + required: + - textLongs ResultSettingsNumber: - type: object - properties: - number: - type: array - items: - type: array - items: - type: number - description: | - 値ごとの回答数の配列 + allOf: + - $ref: "#/components/schemas/QuestionTypeNumber" + - $ref: "#/components/schemas/ResultSettingsAnswerCountPerNumber" + description: | + 数値ごとの回答数の配列 ResultSettingsSingleChoice: + allOf: + - $ref: "#/components/schemas/QuestionTypeSingleChoice" + - $ref: "#/components/schemas/ResultSettingsAnswerCountPerIndex" + description: | + 選択肢ごとの回答数の配列 + ResultSettingsMultipleChoice: + allOf: + - $ref: "#/components/schemas/QuestionTypeMultipleChoice" + - $ref: "#/components/schemas/ResultSettingsAnswerCountPerIndex" + description: | + 選択肢ごとの回答数の配列 + ResultSettingsScale: + allOf: + - $ref: "#/components/schemas/QuestionTypeScale" + - $ref: "#/components/schemas/ResultSettingsAnswerCountPerNumber" + description: | + 数値ごとの回答数の配列 + ResultSettingsAnswerCountPerNumber: type: object properties: - index: + answerCountPerNumber: #TODO: 配列なのに複数形じゃないの気になる type: array items: - type: array - items: - type: number - description: | - 選択肢ごとの回答数の配列 - ResultSettingsMultipleChoice: + type: object + properties: + number: + type: number + answerCount: + type: number + required: + - number + - answerCount + required: + - indexes + ResultSettingsAnswerCountPerIndex: type: object properties: - answerIndexes: + AnswerCountPerIndex: #TODO: 配列なのに複数形じゃないの気になるv2 type: array items: - type: array - items: - type: number - description: | - 選択肢ごとの回答数の配列 - ResultSettingsScale: - type: object - properties: - number: - type: integer + type: object + properties: + index: + type: number + answerCount: + type: number + required: + - index + - answerCount + required: + - indexes UsersAndGroups: type: object properties: From 737df2e4822265d6fe20712cd18a2a79b2ea7fc0 Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 15:48:45 +0900 Subject: [PATCH 28/77] =?UTF-8?q?[docs]=20swagger.yaml=20git=20pull=20--re?= =?UTF-8?q?base=20=E3=81=A7=E7=99=BA=E7=94=9F=E3=81=97=E3=81=9F=E3=82=A8?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 4ff5762c..67e91191 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -1010,8 +1010,7 @@ components: items: type: string example: 1 - authorizationUrl: "https://q.trap.jp/api/v3/oauth2/authorize" - tokenUrl: "https://q.trap.jp/api/v3/oauth2/token" + description: | Group UUID securitySchemes: application: From ca0a478dca1e3127fb159446b4f6fe6db7fded92 Mon Sep 17 00:00:00 2001 From: cp-20 <47262658+mario-hsp@users.noreply.github.com> Date: Tue, 12 Dec 2023 15:53:46 +0900 Subject: [PATCH 29/77] =?UTF-8?q?chore:=20swagger.yaml=20=E3=81=AEauthoriz?= =?UTF-8?q?ation=E5=91=A8=E3=82=8A=E3=82=92=E6=95=B4=E5=82=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 67e91191..bdce6f6e 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -1017,7 +1017,8 @@ components: type: oauth2 flows: clientCredentials: - tokenUrl: "http://example.com/oauth/token" + authorizationUrl: "https://q.trap.jp/api/v3/oauth2/authorize" + tokenUrl: "https://q.trap.jp/api/v3/oauth2/token" scopes: write: allows modifying resources read: allows reading resources From d189d035d7e8cfa94b7416d0cca330bf26fb00c4 Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 16:06:23 +0900 Subject: [PATCH 30/77] =?UTF-8?q?[chore]=20swagger.yaml=20QuestionnaireRes?= =?UTF-8?q?pondents=E3=81=AE=E3=83=9F=E3=82=B9=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index bdce6f6e..40a82263 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -601,7 +601,12 @@ components: - targets - admins QuestionnaireRespondents: - $ref: "#/components/schemas/Users" + type: object + properties: + respondents: + $ref: "#/components/schemas/Users" + required: + - respondents QuestionnaireHasMyResponse: type: object properties: From f9ccc61c12edd02e6f1633e13989b72b4022a4de Mon Sep 17 00:00:00 2001 From: cp-20 <47262658+mario-hsp@users.noreply.github.com> Date: Tue, 12 Dec 2023 16:07:58 +0900 Subject: [PATCH 31/77] =?UTF-8?q?chore:=20securitySchemas=20=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index bdce6f6e..53279fef 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -1016,7 +1016,7 @@ components: application: type: oauth2 flows: - clientCredentials: + authorizationCode: authorizationUrl: "https://q.trap.jp/api/v3/oauth2/authorize" tokenUrl: "https://q.trap.jp/api/v3/oauth2/token" scopes: From 25a3b0d1548bbaf31c53d2cc6313442bebd07215 Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 16:12:56 +0900 Subject: [PATCH 32/77] =?UTF-8?q?[chore]=20swagger.yaml=20review=E3=81=AB?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C=E3=81=97=E3=81=9F=E7=B4=B0=E3=81=8B=E3=81=AA?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 7d473955..dc472542 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -18,7 +18,7 @@ security: tags: - name: questionnaire - name: response -paths: +paths: #TODO 変数の命名を確認する /questionnaires: # TODO: 取得個数可変でもいいかも get: operationId: getQuestionnaires @@ -324,21 +324,21 @@ components: schema: type: integer onlyTargetingMeInQuery: - name: isTargetingMe + name: onlyTargetingMe in: query description: | 自分がターゲットになっているもののみ取得 (true), ターゲットになっているものも含めてすべて取得 (false)。デフォルトはfalse。 schema: type: boolean onlyAdministratedByMeInQuery: - name: isAdministratedByMe + name: onlyAdministratedByMe in: query description: | 自分が管理者になっていないもののみ取得 (true), 管理者になっているものも含めてすべて取得 (false)。デフォルトはfalse。 schema: type: boolean onlyMyResponseInQuery: - name: isMyResponse + name: onlyMyResponse in: query description: | 自分の回答のみ取得 (true), 自分の回答以外も含めてすべて取得 (false)。デフォルトはfalse。 From 6f2cb34df95a434758ced911631c1f17231ac24d Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 16:38:13 +0900 Subject: [PATCH 33/77] =?UTF-8?q?[chore]=20swagger.yaml=20/questionnaires/?= =?UTF-8?q?{questionnaireID}/myRemindStatus=20=E3=81=AE=E4=BD=9C=E6=88=90(?= =?UTF-8?q?=E3=83=97=E3=83=AD=E3=83=88=E3=82=BF=E3=82=A4=E3=83=97)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 49 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index dc472542..c82469c0 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -121,6 +121,49 @@ paths: #TODO 変数の命名を確認する description: アンケートのIDが無効です "500": description: アンケートの削除ができませんでした + /questionnaires/{questionnaireID}/myRemindStatus: + get: + operationId: getQuestionnaireMyRemindStatus + tags: + - questionnaire + description: 自分に対するリマインドが有効かどうかを取得します。 + parameters: + - $ref: "#/components/parameters/questionnaireIDInPath" + responses: + "200": + description: 正常に取得できました。 + content: + application/json: + schema: + $ref: "#/components/schemas/QuestionnaireMyRemindStatus" + "400": + description: アンケートのIDが無効です + "404": + description: アンケートが存在しません + "500": + description: リマインド設定を正常に取得できませんでした + patch: + operationId: editQuestionnaireMyRemindStatus + tags: + - questionnaire + description: 自分に対するリマインドが有効かどうかを変更します。 + parameters: + - $ref: "#/components/parameters/questionnaireIDInPath" + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/QuestionnaireMyRemindStatus" + responses: + "200": + description: 正常に変更できました。 + "400": + description: アンケートのIDが無効です + "404": + description: アンケートが存在しません + "500": + description: リマインド設定を正常に変更できませんでした /questionnaires/{questionnaireID}/responses: get: operationId: getQuestionnaireResponses @@ -266,7 +309,7 @@ paths: #TODO 変数の命名を確認する description: 回答期限が過ぎたため回答を削除できません "500": description: responseIDを取得できませんでした - /responses/MyResponses: + /responses/myResponses: get: operationId: getMyResponses tags: @@ -615,6 +658,10 @@ components: description: 回答済みあるいは下書きが存在する required: - has_response + QuestionnaireMyRemindStatus: + type: boolean + description: | + 自分に対するリマインドが有効かどうか NewQuestion: allOf: - $ref: "#/components/schemas/QuestionBase" From 70aa42c461d057026a84d573666d9578df544a5e Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 16:44:37 +0900 Subject: [PATCH 34/77] =?UTF-8?q?[chore]=20swagger.yaml=20QuestionnaireMyR?= =?UTF-8?q?emindStatus=E3=81=AEdescription=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index c82469c0..2e8e785a 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -661,7 +661,7 @@ components: QuestionnaireMyRemindStatus: type: boolean description: | - 自分に対するリマインドが有効かどうか + 自分に対するリマインドが有効かどうか。ユーザーが対象者でありかつ回答していない場合、この値がtrueであればリマインドが送信される。 NewQuestion: allOf: - $ref: "#/components/schemas/QuestionBase" From 831dfda693013592fd4b1f17d577a40ab5476ae9 Mon Sep 17 00:00:00 2001 From: cp-20 <47262658+mario-hsp@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:44:28 +0900 Subject: [PATCH 35/77] =?UTF-8?q?chore:=20swagger.yaml=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20(NewResponse=E3=81=AErespondent=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4=E3=80=81submitted=5Fat=E3=81=A8modified=5Fat=E3=82=92?= =?UTF-8?q?Response=E3=81=AB=E7=A7=BB=E5=8B=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 378 +++++++++++++++++++------------------- 1 file changed, 187 insertions(+), 191 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 2e8e785a..3b9bfeca 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -1,8 +1,8 @@ openapi: 3.0.0 servers: - - url: "https://anke-to.trap.jp/api" + - url: 'https://anke-to.trap.jp/api' description: production - - url: "http://localhost:8080/api" + - url: 'http://localhost:8080/api' description: local info: title: anke-to API @@ -10,7 +10,7 @@ info: description: anke-to API contact: name: traP - url: "https://github.com/traPtitech/anke-to" + url: 'https://github.com/traPtitech/anke-to' security: - application: - read @@ -26,23 +26,23 @@ paths: #TODO 変数の命名を確認する - questionnaire description: 与えられた条件を満たす20件以下のアンケートのリストを取得します。 parameters: - - $ref: "#/components/parameters/sortInQuery" - - $ref: "#/components/parameters/searchInQuery" - - $ref: "#/components/parameters/pageInQuery" - - $ref: "#/components/parameters/onlyTargetingMeInQuery" - - $ref: "#/components/parameters/onlyAdministratedByMeInQuery" + - $ref: '#/components/parameters/sortInQuery' + - $ref: '#/components/parameters/searchInQuery' + - $ref: '#/components/parameters/pageInQuery' + - $ref: '#/components/parameters/onlyTargetingMeInQuery' + - $ref: '#/components/parameters/onlyAdministratedByMeInQuery' responses: - "200": + '200': description: 正常に取得できました。アンケートの配列を返します。 content: application/json: schema: - $ref: "#/components/schemas/QuestionnaireList" - "400": + $ref: '#/components/schemas/QuestionnaireList' + '400': description: 与えられた情報の形式が異なります - "500": + '500': description: アンケートを正常に取得できませんでした - "503": + '503': description: SQLの実行時間が3sを超えた場合。主に正規表現が原因。 post: operationId: postQuestionnaire @@ -54,17 +54,17 @@ paths: #TODO 変数の命名を確認する content: application/json: schema: - $ref: "#/components/schemas/NewQuestionnaire" + $ref: '#/components/schemas/NewQuestionnaire' responses: - "201": + '201': description: 正常にアンケートを作成できました。作成されたアンケートを返します。 content: application/json: schema: - $ref: "#/components/schemas/QuestionnaireDetail" - "400": + $ref: '#/components/schemas/QuestionnaireDetail' + '400': description: 与えられた情報の形式が異なります - "500": + '500': description: アンケートを正常に作成できませんでした /questionnaires/{questionnaireID}: get: @@ -73,19 +73,19 @@ paths: #TODO 変数の命名を確認する - questionnaire description: アンケートの情報を取得します。 parameters: - - $ref: "#/components/parameters/questionnaireIDInPath" + - $ref: '#/components/parameters/questionnaireIDInPath' responses: - "200": + '200': description: 正常に取得できました。 content: application/json: schema: - $ref: "#/components/schemas/QuestionnaireDetail" - "400": + $ref: '#/components/schemas/QuestionnaireDetail' + '400': description: アンケートのIDが無効です - "404": + '404': description: アンケートが存在しません - "500": + '500': description: アンケートを正常に取得できませんでした patch: operationId: editQuestionnaire @@ -93,19 +93,19 @@ paths: #TODO 変数の命名を確認する - questionnaire description: アンケートの情報を変更します。 parameters: - - $ref: "#/components/parameters/questionnaireIDInPath" + - $ref: '#/components/parameters/questionnaireIDInPath' requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/QuestionnaireDetail" + $ref: '#/components/schemas/QuestionnaireDetail' responses: - "200": + '200': description: 正常にアンケートを変更できました。 - "400": + '400': description: アンケートのIDが無効です - "500": + '500': description: 正常にアンケートを変更できませんでした delete: operationId: deleteQuestionnaire @@ -113,13 +113,13 @@ paths: #TODO 変数の命名を確認する - questionnaire description: アンケートを削除します。 parameters: - - $ref: "#/components/parameters/questionnaireIDInPath" + - $ref: '#/components/parameters/questionnaireIDInPath' responses: - "200": + '200': description: 正常にアンケートを削除できました。 - "400": + '400': description: アンケートのIDが無効です - "500": + '500': description: アンケートの削除ができませんでした /questionnaires/{questionnaireID}/myRemindStatus: get: @@ -128,19 +128,19 @@ paths: #TODO 変数の命名を確認する - questionnaire description: 自分に対するリマインドが有効かどうかを取得します。 parameters: - - $ref: "#/components/parameters/questionnaireIDInPath" + - $ref: '#/components/parameters/questionnaireIDInPath' responses: - "200": + '200': description: 正常に取得できました。 content: application/json: schema: - $ref: "#/components/schemas/QuestionnaireMyRemindStatus" - "400": + $ref: '#/components/schemas/QuestionnaireMyRemindStatus' + '400': description: アンケートのIDが無効です - "404": + '404': description: アンケートが存在しません - "500": + '500': description: リマインド設定を正常に取得できませんでした patch: operationId: editQuestionnaireMyRemindStatus @@ -148,21 +148,21 @@ paths: #TODO 変数の命名を確認する - questionnaire description: 自分に対するリマインドが有効かどうかを変更します。 parameters: - - $ref: "#/components/parameters/questionnaireIDInPath" + - $ref: '#/components/parameters/questionnaireIDInPath' requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/QuestionnaireMyRemindStatus" + $ref: '#/components/schemas/QuestionnaireMyRemindStatus' responses: - "200": + '200': description: 正常に変更できました。 - "400": + '400': description: アンケートのIDが無効です - "404": + '404': description: アンケートが存在しません - "500": + '500': description: リマインド設定を正常に変更できませんでした /questionnaires/{questionnaireID}/responses: get: @@ -171,23 +171,23 @@ paths: #TODO 変数の命名を確認する - questionnaire description: アンケートの全ての回答を取得します。アンケートが匿名回答の場合、取得できません。 parameters: - - $ref: "#/components/parameters/questionnaireIDInPath" - - $ref: "#/components/parameters/responseSortInQuery" - - $ref: "#/components/parameters/onlyMyResponseInQuery" + - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: '#/components/parameters/responseSortInQuery' + - $ref: '#/components/parameters/onlyMyResponseInQuery' responses: - "200": + '200': description: 正常に取得できました。 content: application/json: schema: - $ref: "#/components/schemas/Responses" - "400": + $ref: '#/components/schemas/Responses' + '400': description: アンケートのIDが無効です - "403": + '403': description: アンケートが匿名回答のため回答を取得できません - "404": + '404': description: アンケートが存在しません - "500": + '500': description: 回答を正常に取得できませんでした post: operationId: postQuestionnaireResponse @@ -195,27 +195,27 @@ paths: #TODO 変数の命名を確認する - questionnaire description: 新しい回答を作成します。アンケートが複数回答可能でない場合、過去の回答が削除されます。 parameters: - - $ref: "#/components/parameters/questionnaireIDInPath" + - $ref: '#/components/parameters/questionnaireIDInPath' requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/NewResponse" + $ref: '#/components/schemas/NewResponse' responses: - "201": + '201': description: 正常に回答を作成できました。作成された回答を返します。 content: application/json: schema: - $ref: "#/components/schemas/Response" - "400": + $ref: '#/components/schemas/Response' + '400': description: 与えられた情報の形式が異なります - "404": + '404': description: アンケートが存在しません - "422": + '422': description: 回答期限が過ぎたため回答できません - "500": + '500': description: 正常に回答が作成できませんでした /questionnaires/{questionnaireID}/result: get: @@ -224,21 +224,21 @@ paths: #TODO 変数の命名を確認する - questionnaire description: アンケートの回答を集計した結果を取得します。回答者の情報は含まれず、アンケートが匿名回答であっても取得できます。 parameters: - - $ref: "#/components/parameters/questionnaireIDInPath" + - $ref: '#/components/parameters/questionnaireIDInPath' responses: - "200": + '200': description: 正常に取得できました。 content: application/json: schema: - $ref: "#/components/schemas/Result" - "400": + $ref: '#/components/schemas/Result' + '400': description: アンケートのIDが無効です - "403": + '403': description: 結果を閲覧する権限がありません。 - "404": + '404': description: アンケートが存在しません - "500": + '500': description: アンケートの結果を正常に取得できませんでした /responses/{responseID}: get: @@ -247,21 +247,21 @@ paths: #TODO 変数の命名を確認する - response description: 回答を取得します。 parameters: - - $ref: "#/components/parameters/responseIDInPath" + - $ref: '#/components/parameters/responseIDInPath' responses: - "200": + '200': description: 正常に取得できました。 content: application/json: schema: - $ref: "#/components/schemas/Response" - "400": + $ref: '#/components/schemas/Response' + '400': description: responseIDが無効です - "403": + '403': description: 回答を閲覧する権限がありません。 - "404": + '404': description: 回答が存在しません - "500": + '500': description: 回答を正常に取得できませんでした patch: operationId: editResponse @@ -269,25 +269,25 @@ paths: #TODO 変数の命名を確認する - response description: 回答を変更します。 parameters: - - $ref: "#/components/parameters/responseIDInPath" + - $ref: '#/components/parameters/responseIDInPath' requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/Response" + $ref: '#/components/schemas/Response' responses: - "200": + '200': description: 正常に回答を変更できました - "400": + '400': description: 与えられた回答の情報が異なります - "403": + '403': description: 回答を変更する権限がありません - "404": + '404': description: アンケートの回答の期限がきれたため回答が存在しません - "405": + '405': description: 回答期限が過ぎたため回答できません - "500": + '500': description: responseIDを取得できませんでした delete: operationId: deleteResponse @@ -295,19 +295,19 @@ paths: #TODO 変数の命名を確認する - response description: 回答を削除します parameters: - - $ref: "#/components/parameters/responseIDInPath" + - $ref: '#/components/parameters/responseIDInPath' responses: - "200": + '200': description: 正常に回答を削除できました - "400": + '400': description: 与えられた回答の情報が異なります - "403": + '403': description: 回答を削除する権限がありません。 - "404": + '404': description: アンケートの回答の期限がきれたため回答が存在しません - "405": + '405': description: 回答期限が過ぎたため回答を削除できません - "500": + '500': description: responseIDを取得できませんでした /responses/myResponses: get: @@ -316,17 +316,17 @@ paths: #TODO 変数の命名を確認する - response description: 自分のすべての回答のリストを取得します。 parameters: - - $ref: "#/components/parameters/responseSortInQuery" + - $ref: '#/components/parameters/responseSortInQuery' responses: - "200": + '200': description: 正常に取得できました。回答の配列を返します。 content: application/json: schema: type: array items: - $ref: "#/components/schemas/Responses" - "500": + $ref: '#/components/schemas/Responses' + '500': description: 自分の回答のリストを取得できませんでした components: parameters: @@ -335,7 +335,7 @@ components: in: query description: 回答したもの(answered)か未回答のもの(unanswered)かを選別 schema: - $ref: "#/components/schemas/AnsweredType" + $ref: '#/components/schemas/AnsweredType' sortInQuery: name: sort in: query @@ -344,7 +344,7 @@ components: タイトルの降順 "-title", 更新日時が新しい "modified_at", 更新日時が古い "-modified_at" ) schema: - $ref: "#/components/schemas/SortType" + $ref: '#/components/schemas/SortType' responseSortInQuery: name: sort in: query @@ -353,7 +353,7 @@ components: タイトルの降順 "-title", 更新日時が新しい "modified_at", 更新日時が古い "-modified_at" ) schema: - $ref: "#/components/schemas/ResponseSortType" + $ref: '#/components/schemas/ResponseSortType' searchInQuery: name: search in: query @@ -475,38 +475,38 @@ components: NewQuestionnaire: allOf: - - $ref: "#/components/schemas/QuestionnaireTitle" - - $ref: "#/components/schemas/QuestionnaireDescription" - - $ref: "#/components/schemas/QuestionnaireResponseDueDateTime" - - $ref: "#/components/schemas/QuestionnaireResponseViewableBy" - - $ref: "#/components/schemas/QuestionnaireIsAnonymous" - - $ref: "#/components/schemas/QuestionnaireIsAllowingMultipleResponses" - - $ref: "#/components/schemas/QuestionnaireIsPublished" - - $ref: "#/components/schemas/QuestionnaireTargetsAndAdmins" + - $ref: '#/components/schemas/QuestionnaireTitle' + - $ref: '#/components/schemas/QuestionnaireDescription' + - $ref: '#/components/schemas/QuestionnaireResponseDueDateTime' + - $ref: '#/components/schemas/QuestionnaireResponseViewableBy' + - $ref: '#/components/schemas/QuestionnaireIsAnonymous' + - $ref: '#/components/schemas/QuestionnaireIsAllowingMultipleResponses' + - $ref: '#/components/schemas/QuestionnaireIsPublished' + - $ref: '#/components/schemas/QuestionnaireTargetsAndAdmins' - properties: questions: type: array items: - $ref: "#/components/schemas/NewQuestion" + $ref: '#/components/schemas/NewQuestion' required: - questions QuestionnaireDetail: allOf: - - $ref: "#/components/schemas/QuestionnaireID" - - $ref: "#/components/schemas/NewQuestionnaire" - - $ref: "#/components/schemas/QuestionnaireRespondents" - - $ref: "#/components/schemas/QuestionnaireCreatedAt" - - $ref: "#/components/schemas/QuestionnaireModifiedAt" + - $ref: '#/components/schemas/QuestionnaireID' + - $ref: '#/components/schemas/NewQuestionnaire' + - $ref: '#/components/schemas/QuestionnaireRespondents' + - $ref: '#/components/schemas/QuestionnaireCreatedAt' + - $ref: '#/components/schemas/QuestionnaireModifiedAt' QuestionnaireSummary: allOf: - - $ref: "#/components/schemas/QuestionnaireID" - - $ref: "#/components/schemas/QuestionnaireTitle" - - $ref: "#/components/schemas/QuestionnaireDescription" - - $ref: "#/components/schemas/QuestionnaireResponseDueDateTime" - - $ref: "#/components/schemas/QuestionnaireResponseViewableBy" - - $ref: "#/components/schemas/QuestionnaireIsAnonymous" - - $ref: "#/components/schemas/QuestionnaireIsAllowingMultipleResponses" - - $ref: "#/components/schemas/QuestionnaireIsPublished" + - $ref: '#/components/schemas/QuestionnaireID' + - $ref: '#/components/schemas/QuestionnaireTitle' + - $ref: '#/components/schemas/QuestionnaireDescription' + - $ref: '#/components/schemas/QuestionnaireResponseDueDateTime' + - $ref: '#/components/schemas/QuestionnaireResponseViewableBy' + - $ref: '#/components/schemas/QuestionnaireIsAnonymous' + - $ref: '#/components/schemas/QuestionnaireIsAllowingMultipleResponses' + - $ref: '#/components/schemas/QuestionnaireIsPublished' - properties: is_targeting_me: type: boolean @@ -544,7 +544,7 @@ components: questionnaires: type: array items: - $ref: "#/components/schemas/QuestionnaireSummary" + $ref: '#/components/schemas/QuestionnaireSummary' required: - page_max - questionnaires @@ -584,7 +584,7 @@ components: type: object properties: response_viewable_by: - $ref: "#/components/schemas/ResShareType" + $ref: '#/components/schemas/ResShareType' required: - response_viewable_by QuestionnaireIsAnonymous: @@ -637,9 +637,9 @@ components: type: object properties: targets: - $ref: "#/components/schemas/UsersAndGroups" + $ref: '#/components/schemas/UsersAndGroups' admins: - $ref: "#/components/schemas/UsersAndGroups" + $ref: '#/components/schemas/UsersAndGroups' required: - targets - admins @@ -647,7 +647,7 @@ components: type: object properties: respondents: - $ref: "#/components/schemas/Users" + $ref: '#/components/schemas/Users' required: - respondents QuestionnaireHasMyResponse: @@ -664,12 +664,12 @@ components: 自分に対するリマインドが有効かどうか。ユーザーが対象者でありかつ回答していない場合、この値がtrueであればリマインドが送信される。 NewQuestion: allOf: - - $ref: "#/components/schemas/QuestionBase" - - $ref: "#/components/schemas/QuestionSettingsByType" + - $ref: '#/components/schemas/QuestionBase' + - $ref: '#/components/schemas/QuestionSettingsByType' Question: allOf: - - $ref: "#/components/schemas/QuestionBase" - - $ref: "#/components/schemas/QuestionSettingsByType" + - $ref: '#/components/schemas/QuestionBase' + - $ref: '#/components/schemas/QuestionSettingsByType' - properties: questionID: type: integer @@ -683,7 +683,7 @@ components: Questions: type: array items: - $ref: "#/components/schemas/Question" + $ref: '#/components/schemas/Question' QuestionBase: type: object properties: @@ -704,15 +704,15 @@ components: - questionnaireID QuestionSettingsByType: oneOf: - - $ref: "#/components/schemas/QuestionSettingsText" - - $ref: "#/components/schemas/QuestionSettingsTextLong" - - $ref: "#/components/schemas/QuestionSettingsNumber" - - $ref: "#/components/schemas/QuestionSettingsSingleChoice" - - $ref: "#/components/schemas/QuestionSettingsMultipleChoice" - - $ref: "#/components/schemas/QuestionSettingsScale" + - $ref: '#/components/schemas/QuestionSettingsText' + - $ref: '#/components/schemas/QuestionSettingsTextLong' + - $ref: '#/components/schemas/QuestionSettingsNumber' + - $ref: '#/components/schemas/QuestionSettingsSingleChoice' + - $ref: '#/components/schemas/QuestionSettingsMultipleChoice' + - $ref: '#/components/schemas/QuestionSettingsScale' QuestionSettingsText: allOf: - - $ref: "#/components/schemas/QuestionTypeText" + - $ref: '#/components/schemas/QuestionTypeText' - type: object properties: maxLength: @@ -721,7 +721,7 @@ components: - maxLength QuestionSettingsTextLong: allOf: - - $ref: "#/components/schemas/QuestionTypeTextLong" + - $ref: '#/components/schemas/QuestionTypeTextLong' - type: object properties: maxLength: @@ -730,7 +730,7 @@ components: - maxLength QuestionSettingsNumber: allOf: - - $ref: "#/components/schemas/QuestionTypeNumber" + - $ref: '#/components/schemas/QuestionTypeNumber' - type: object properties: minValue: @@ -742,7 +742,7 @@ components: - maxValue QuestionSettingsSingleChoice: allOf: - - $ref: "#/components/schemas/QuestionTypeSingleChoice" + - $ref: '#/components/schemas/QuestionTypeSingleChoice' - type: object properties: options: @@ -753,7 +753,7 @@ components: - options QuestionSettingsMultipleChoice: allOf: - - $ref: "#/components/schemas/QuestionTypeMultipleChoice" + - $ref: '#/components/schemas/QuestionTypeMultipleChoice' - type: object properties: options: @@ -764,7 +764,7 @@ components: - options QuestionSettingsScale: allOf: - - $ref: "#/components/schemas/QuestionTypeScale" + - $ref: '#/components/schemas/QuestionTypeScale' - type: object properties: minValue: @@ -778,54 +778,50 @@ components: NewResponse: type: object properties: - respondent: - type: string - example: lolico is_draft: type: boolean example: true - submitted_at: - type: string - format: date-time - modified_at: - type: string - format: date-time body: type: array items: - $ref: "#/components/schemas/ResponseBody" + $ref: '#/components/schemas/ResponseBody' required: - - respondent - is_draft - - submitted_at - - modified_at - body Response: allOf: - - $ref: "#/components/schemas/QuestionnaireID" + - $ref: '#/components/schemas/QuestionnaireID' - type: object properties: responseID: type: integer example: 1 + submitted_at: + type: string + format: date-time + modified_at: + type: string + format: date-time required: - responseID - - $ref: "#/components/schemas/NewResponse" + - submitted_at + - modified_at + - $ref: '#/components/schemas/NewResponse' Responses: type: array items: - $ref: "#/components/schemas/Response" + $ref: '#/components/schemas/Response' ResponseBody: oneOf: - - $ref: "#/components/schemas/ResponseSettingsText" - - $ref: "#/components/schemas/ResponseSettingsTextLong" - - $ref: "#/components/schemas/ResponseSettingsNumber" - - $ref: "#/components/schemas/ResponseSettingsSingleChoice" - - $ref: "#/components/schemas/ResponseSettingsMultipleChoice" - - $ref: "#/components/schemas/ResponseSettingsScale" + - $ref: '#/components/schemas/ResponseSettingsText' + - $ref: '#/components/schemas/ResponseSettingsTextLong' + - $ref: '#/components/schemas/ResponseSettingsNumber' + - $ref: '#/components/schemas/ResponseSettingsSingleChoice' + - $ref: '#/components/schemas/ResponseSettingsMultipleChoice' + - $ref: '#/components/schemas/ResponseSettingsScale' ResponseSettingsText: allOf: - - $ref: "#/components/schemas/QuestionTypeText" + - $ref: '#/components/schemas/QuestionTypeText' - type: object properties: text: @@ -834,7 +830,7 @@ components: - text ResponseSettingsTextLong: allOf: - - $ref: "#/components/schemas/QuestionTypeTextLong" + - $ref: '#/components/schemas/QuestionTypeTextLong' - type: object properties: textLong: @@ -843,7 +839,7 @@ components: - textLong ResponseSettingsNumber: allOf: - - $ref: "#/components/schemas/QuestionTypeNumber" + - $ref: '#/components/schemas/QuestionTypeNumber' - type: object properties: number: @@ -852,7 +848,7 @@ components: - number ResponseSettingsSingleChoice: allOf: - - $ref: "#/components/schemas/QuestionTypeSingleChoice" + - $ref: '#/components/schemas/QuestionTypeSingleChoice' - type: object properties: index: @@ -863,7 +859,7 @@ components: - index ResponseSettingsMultipleChoice: allOf: - - $ref: "#/components/schemas/QuestionTypeMultipleChoice" + - $ref: '#/components/schemas/QuestionTypeMultipleChoice' - type: object properties: indexes: @@ -876,7 +872,7 @@ components: - indexes ResponseSettingsScale: allOf: - - $ref: "#/components/schemas/QuestionTypeScale" + - $ref: '#/components/schemas/QuestionTypeScale' - type: object properties: number: @@ -943,22 +939,22 @@ components: body: type: array items: - $ref: "#/components/schemas/ResultBody" + $ref: '#/components/schemas/ResultBody' required: - questionnaireID - responseCount - body ResultBody: oneOf: - - $ref: "#/components/schemas/ResultSettingsText" - - $ref: "#/components/schemas/ResultSettingsTextLong" - - $ref: "#/components/schemas/ResultSettingsNumber" - - $ref: "#/components/schemas/ResultSettingsSingleChoice" - - $ref: "#/components/schemas/ResultSettingsMultipleChoice" - - $ref: "#/components/schemas/ResultSettingsScale" + - $ref: '#/components/schemas/ResultSettingsText' + - $ref: '#/components/schemas/ResultSettingsTextLong' + - $ref: '#/components/schemas/ResultSettingsNumber' + - $ref: '#/components/schemas/ResultSettingsSingleChoice' + - $ref: '#/components/schemas/ResultSettingsMultipleChoice' + - $ref: '#/components/schemas/ResultSettingsScale' ResultSettingsText: allOf: - - $ref: "#/components/schemas/QuestionTypeText" + - $ref: '#/components/schemas/QuestionTypeText' - type: object properties: answers: @@ -971,7 +967,7 @@ components: - texts ResultSettingsTextLong: allOf: - - $ref: "#/components/schemas/QuestionTypeTextLong" + - $ref: '#/components/schemas/QuestionTypeTextLong' - type: object properties: answers: @@ -984,26 +980,26 @@ components: - textLongs ResultSettingsNumber: allOf: - - $ref: "#/components/schemas/QuestionTypeNumber" - - $ref: "#/components/schemas/ResultSettingsAnswerCountPerNumber" + - $ref: '#/components/schemas/QuestionTypeNumber' + - $ref: '#/components/schemas/ResultSettingsAnswerCountPerNumber' description: | 数値ごとの回答数の配列 ResultSettingsSingleChoice: allOf: - - $ref: "#/components/schemas/QuestionTypeSingleChoice" - - $ref: "#/components/schemas/ResultSettingsAnswerCountPerIndex" + - $ref: '#/components/schemas/QuestionTypeSingleChoice' + - $ref: '#/components/schemas/ResultSettingsAnswerCountPerIndex' description: | 選択肢ごとの回答数の配列 ResultSettingsMultipleChoice: allOf: - - $ref: "#/components/schemas/QuestionTypeMultipleChoice" - - $ref: "#/components/schemas/ResultSettingsAnswerCountPerIndex" + - $ref: '#/components/schemas/QuestionTypeMultipleChoice' + - $ref: '#/components/schemas/ResultSettingsAnswerCountPerIndex' description: | 選択肢ごとの回答数の配列 ResultSettingsScale: allOf: - - $ref: "#/components/schemas/QuestionTypeScale" - - $ref: "#/components/schemas/ResultSettingsAnswerCountPerNumber" + - $ref: '#/components/schemas/QuestionTypeScale' + - $ref: '#/components/schemas/ResultSettingsAnswerCountPerNumber' description: | 数値ごとの回答数の配列 ResultSettingsAnswerCountPerNumber: @@ -1044,9 +1040,9 @@ components: type: object properties: users: - $ref: "#/components/schemas/Users" + $ref: '#/components/schemas/Users' groups: - $ref: "#/components/schemas/Groups" + $ref: '#/components/schemas/Groups' required: - users - groups @@ -1069,8 +1065,8 @@ components: type: oauth2 flows: authorizationCode: - authorizationUrl: "https://q.trap.jp/api/v3/oauth2/authorize" - tokenUrl: "https://q.trap.jp/api/v3/oauth2/token" + authorizationUrl: 'https://q.trap.jp/api/v3/oauth2/authorize' + tokenUrl: 'https://q.trap.jp/api/v3/oauth2/token' scopes: write: allows modifying resources read: allows reading resources From c81041bf518a36cd7817cfc2c1312682228b678d Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 21:28:34 +0900 Subject: [PATCH 36/77] =?UTF-8?q?[chore]=20swagger.yaml=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20formatter=E3=81=8C=E5=8A=B9=E3=81=84=E3=81=9F?= =?UTF-8?q?=E3=81=A0=E3=81=91=E3=81=AE=E8=99=9A=E7=84=A1=E3=82=B3=E3=83=9F?= =?UTF-8?q?=E3=83=83=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 358 +++++++++++++++++++------------------- 1 file changed, 179 insertions(+), 179 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 3b9bfeca..e418b704 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -1,8 +1,8 @@ openapi: 3.0.0 servers: - - url: 'https://anke-to.trap.jp/api' + - url: "https://anke-to.trap.jp/api" description: production - - url: 'http://localhost:8080/api' + - url: "http://localhost:8080/api" description: local info: title: anke-to API @@ -10,7 +10,7 @@ info: description: anke-to API contact: name: traP - url: 'https://github.com/traPtitech/anke-to' + url: "https://github.com/traPtitech/anke-to" security: - application: - read @@ -26,23 +26,23 @@ paths: #TODO 変数の命名を確認する - questionnaire description: 与えられた条件を満たす20件以下のアンケートのリストを取得します。 parameters: - - $ref: '#/components/parameters/sortInQuery' - - $ref: '#/components/parameters/searchInQuery' - - $ref: '#/components/parameters/pageInQuery' - - $ref: '#/components/parameters/onlyTargetingMeInQuery' - - $ref: '#/components/parameters/onlyAdministratedByMeInQuery' + - $ref: "#/components/parameters/sortInQuery" + - $ref: "#/components/parameters/searchInQuery" + - $ref: "#/components/parameters/pageInQuery" + - $ref: "#/components/parameters/onlyTargetingMeInQuery" + - $ref: "#/components/parameters/onlyAdministratedByMeInQuery" responses: - '200': + "200": description: 正常に取得できました。アンケートの配列を返します。 content: application/json: schema: - $ref: '#/components/schemas/QuestionnaireList' - '400': + $ref: "#/components/schemas/QuestionnaireList" + "400": description: 与えられた情報の形式が異なります - '500': + "500": description: アンケートを正常に取得できませんでした - '503': + "503": description: SQLの実行時間が3sを超えた場合。主に正規表現が原因。 post: operationId: postQuestionnaire @@ -54,17 +54,17 @@ paths: #TODO 変数の命名を確認する content: application/json: schema: - $ref: '#/components/schemas/NewQuestionnaire' + $ref: "#/components/schemas/NewQuestionnaire" responses: - '201': + "201": description: 正常にアンケートを作成できました。作成されたアンケートを返します。 content: application/json: schema: - $ref: '#/components/schemas/QuestionnaireDetail' - '400': + $ref: "#/components/schemas/QuestionnaireDetail" + "400": description: 与えられた情報の形式が異なります - '500': + "500": description: アンケートを正常に作成できませんでした /questionnaires/{questionnaireID}: get: @@ -73,19 +73,19 @@ paths: #TODO 変数の命名を確認する - questionnaire description: アンケートの情報を取得します。 parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" responses: - '200': + "200": description: 正常に取得できました。 content: application/json: schema: - $ref: '#/components/schemas/QuestionnaireDetail' - '400': + $ref: "#/components/schemas/QuestionnaireDetail" + "400": description: アンケートのIDが無効です - '404': + "404": description: アンケートが存在しません - '500': + "500": description: アンケートを正常に取得できませんでした patch: operationId: editQuestionnaire @@ -93,19 +93,19 @@ paths: #TODO 変数の命名を確認する - questionnaire description: アンケートの情報を変更します。 parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/QuestionnaireDetail' + $ref: "#/components/schemas/QuestionnaireDetail" responses: - '200': + "200": description: 正常にアンケートを変更できました。 - '400': + "400": description: アンケートのIDが無効です - '500': + "500": description: 正常にアンケートを変更できませんでした delete: operationId: deleteQuestionnaire @@ -113,13 +113,13 @@ paths: #TODO 変数の命名を確認する - questionnaire description: アンケートを削除します。 parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" responses: - '200': + "200": description: 正常にアンケートを削除できました。 - '400': + "400": description: アンケートのIDが無効です - '500': + "500": description: アンケートの削除ができませんでした /questionnaires/{questionnaireID}/myRemindStatus: get: @@ -128,19 +128,19 @@ paths: #TODO 変数の命名を確認する - questionnaire description: 自分に対するリマインドが有効かどうかを取得します。 parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" responses: - '200': + "200": description: 正常に取得できました。 content: application/json: schema: - $ref: '#/components/schemas/QuestionnaireMyRemindStatus' - '400': + $ref: "#/components/schemas/QuestionnaireMyRemindStatus" + "400": description: アンケートのIDが無効です - '404': + "404": description: アンケートが存在しません - '500': + "500": description: リマインド設定を正常に取得できませんでした patch: operationId: editQuestionnaireMyRemindStatus @@ -148,21 +148,21 @@ paths: #TODO 変数の命名を確認する - questionnaire description: 自分に対するリマインドが有効かどうかを変更します。 parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/QuestionnaireMyRemindStatus' + $ref: "#/components/schemas/QuestionnaireMyRemindStatus" responses: - '200': + "200": description: 正常に変更できました。 - '400': + "400": description: アンケートのIDが無効です - '404': + "404": description: アンケートが存在しません - '500': + "500": description: リマインド設定を正常に変更できませんでした /questionnaires/{questionnaireID}/responses: get: @@ -171,23 +171,23 @@ paths: #TODO 変数の命名を確認する - questionnaire description: アンケートの全ての回答を取得します。アンケートが匿名回答の場合、取得できません。 parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' - - $ref: '#/components/parameters/responseSortInQuery' - - $ref: '#/components/parameters/onlyMyResponseInQuery' + - $ref: "#/components/parameters/questionnaireIDInPath" + - $ref: "#/components/parameters/responseSortInQuery" + - $ref: "#/components/parameters/onlyMyResponseInQuery" responses: - '200': + "200": description: 正常に取得できました。 content: application/json: schema: - $ref: '#/components/schemas/Responses' - '400': + $ref: "#/components/schemas/Responses" + "400": description: アンケートのIDが無効です - '403': + "403": description: アンケートが匿名回答のため回答を取得できません - '404': + "404": description: アンケートが存在しません - '500': + "500": description: 回答を正常に取得できませんでした post: operationId: postQuestionnaireResponse @@ -195,27 +195,27 @@ paths: #TODO 変数の命名を確認する - questionnaire description: 新しい回答を作成します。アンケートが複数回答可能でない場合、過去の回答が削除されます。 parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/NewResponse' + $ref: "#/components/schemas/NewResponse" responses: - '201': + "201": description: 正常に回答を作成できました。作成された回答を返します。 content: application/json: schema: - $ref: '#/components/schemas/Response' - '400': + $ref: "#/components/schemas/Response" + "400": description: 与えられた情報の形式が異なります - '404': + "404": description: アンケートが存在しません - '422': + "422": description: 回答期限が過ぎたため回答できません - '500': + "500": description: 正常に回答が作成できませんでした /questionnaires/{questionnaireID}/result: get: @@ -224,21 +224,21 @@ paths: #TODO 変数の命名を確認する - questionnaire description: アンケートの回答を集計した結果を取得します。回答者の情報は含まれず、アンケートが匿名回答であっても取得できます。 parameters: - - $ref: '#/components/parameters/questionnaireIDInPath' + - $ref: "#/components/parameters/questionnaireIDInPath" responses: - '200': + "200": description: 正常に取得できました。 content: application/json: schema: - $ref: '#/components/schemas/Result' - '400': + $ref: "#/components/schemas/Result" + "400": description: アンケートのIDが無効です - '403': + "403": description: 結果を閲覧する権限がありません。 - '404': + "404": description: アンケートが存在しません - '500': + "500": description: アンケートの結果を正常に取得できませんでした /responses/{responseID}: get: @@ -247,21 +247,21 @@ paths: #TODO 変数の命名を確認する - response description: 回答を取得します。 parameters: - - $ref: '#/components/parameters/responseIDInPath' + - $ref: "#/components/parameters/responseIDInPath" responses: - '200': + "200": description: 正常に取得できました。 content: application/json: schema: - $ref: '#/components/schemas/Response' - '400': + $ref: "#/components/schemas/Response" + "400": description: responseIDが無効です - '403': + "403": description: 回答を閲覧する権限がありません。 - '404': + "404": description: 回答が存在しません - '500': + "500": description: 回答を正常に取得できませんでした patch: operationId: editResponse @@ -269,25 +269,25 @@ paths: #TODO 変数の命名を確認する - response description: 回答を変更します。 parameters: - - $ref: '#/components/parameters/responseIDInPath' + - $ref: "#/components/parameters/responseIDInPath" requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" responses: - '200': + "200": description: 正常に回答を変更できました - '400': + "400": description: 与えられた回答の情報が異なります - '403': + "403": description: 回答を変更する権限がありません - '404': + "404": description: アンケートの回答の期限がきれたため回答が存在しません - '405': + "405": description: 回答期限が過ぎたため回答できません - '500': + "500": description: responseIDを取得できませんでした delete: operationId: deleteResponse @@ -295,19 +295,19 @@ paths: #TODO 変数の命名を確認する - response description: 回答を削除します parameters: - - $ref: '#/components/parameters/responseIDInPath' + - $ref: "#/components/parameters/responseIDInPath" responses: - '200': + "200": description: 正常に回答を削除できました - '400': + "400": description: 与えられた回答の情報が異なります - '403': + "403": description: 回答を削除する権限がありません。 - '404': + "404": description: アンケートの回答の期限がきれたため回答が存在しません - '405': + "405": description: 回答期限が過ぎたため回答を削除できません - '500': + "500": description: responseIDを取得できませんでした /responses/myResponses: get: @@ -316,17 +316,17 @@ paths: #TODO 変数の命名を確認する - response description: 自分のすべての回答のリストを取得します。 parameters: - - $ref: '#/components/parameters/responseSortInQuery' + - $ref: "#/components/parameters/responseSortInQuery" responses: - '200': + "200": description: 正常に取得できました。回答の配列を返します。 content: application/json: schema: type: array items: - $ref: '#/components/schemas/Responses' - '500': + $ref: "#/components/schemas/Responses" + "500": description: 自分の回答のリストを取得できませんでした components: parameters: @@ -335,7 +335,7 @@ components: in: query description: 回答したもの(answered)か未回答のもの(unanswered)かを選別 schema: - $ref: '#/components/schemas/AnsweredType' + $ref: "#/components/schemas/AnsweredType" sortInQuery: name: sort in: query @@ -344,7 +344,7 @@ components: タイトルの降順 "-title", 更新日時が新しい "modified_at", 更新日時が古い "-modified_at" ) schema: - $ref: '#/components/schemas/SortType' + $ref: "#/components/schemas/SortType" responseSortInQuery: name: sort in: query @@ -353,7 +353,7 @@ components: タイトルの降順 "-title", 更新日時が新しい "modified_at", 更新日時が古い "-modified_at" ) schema: - $ref: '#/components/schemas/ResponseSortType' + $ref: "#/components/schemas/ResponseSortType" searchInQuery: name: search in: query @@ -475,38 +475,38 @@ components: NewQuestionnaire: allOf: - - $ref: '#/components/schemas/QuestionnaireTitle' - - $ref: '#/components/schemas/QuestionnaireDescription' - - $ref: '#/components/schemas/QuestionnaireResponseDueDateTime' - - $ref: '#/components/schemas/QuestionnaireResponseViewableBy' - - $ref: '#/components/schemas/QuestionnaireIsAnonymous' - - $ref: '#/components/schemas/QuestionnaireIsAllowingMultipleResponses' - - $ref: '#/components/schemas/QuestionnaireIsPublished' - - $ref: '#/components/schemas/QuestionnaireTargetsAndAdmins' + - $ref: "#/components/schemas/QuestionnaireTitle" + - $ref: "#/components/schemas/QuestionnaireDescription" + - $ref: "#/components/schemas/QuestionnaireResponseDueDateTime" + - $ref: "#/components/schemas/QuestionnaireResponseViewableBy" + - $ref: "#/components/schemas/QuestionnaireIsAnonymous" + - $ref: "#/components/schemas/QuestionnaireIsAllowingMultipleResponses" + - $ref: "#/components/schemas/QuestionnaireIsPublished" + - $ref: "#/components/schemas/QuestionnaireTargetsAndAdmins" - properties: questions: type: array items: - $ref: '#/components/schemas/NewQuestion' + $ref: "#/components/schemas/NewQuestion" required: - questions QuestionnaireDetail: allOf: - - $ref: '#/components/schemas/QuestionnaireID' - - $ref: '#/components/schemas/NewQuestionnaire' - - $ref: '#/components/schemas/QuestionnaireRespondents' - - $ref: '#/components/schemas/QuestionnaireCreatedAt' - - $ref: '#/components/schemas/QuestionnaireModifiedAt' + - $ref: "#/components/schemas/QuestionnaireID" + - $ref: "#/components/schemas/NewQuestionnaire" + - $ref: "#/components/schemas/QuestionnaireRespondents" + - $ref: "#/components/schemas/QuestionnaireCreatedAt" + - $ref: "#/components/schemas/QuestionnaireModifiedAt" QuestionnaireSummary: allOf: - - $ref: '#/components/schemas/QuestionnaireID' - - $ref: '#/components/schemas/QuestionnaireTitle' - - $ref: '#/components/schemas/QuestionnaireDescription' - - $ref: '#/components/schemas/QuestionnaireResponseDueDateTime' - - $ref: '#/components/schemas/QuestionnaireResponseViewableBy' - - $ref: '#/components/schemas/QuestionnaireIsAnonymous' - - $ref: '#/components/schemas/QuestionnaireIsAllowingMultipleResponses' - - $ref: '#/components/schemas/QuestionnaireIsPublished' + - $ref: "#/components/schemas/QuestionnaireID" + - $ref: "#/components/schemas/QuestionnaireTitle" + - $ref: "#/components/schemas/QuestionnaireDescription" + - $ref: "#/components/schemas/QuestionnaireResponseDueDateTime" + - $ref: "#/components/schemas/QuestionnaireResponseViewableBy" + - $ref: "#/components/schemas/QuestionnaireIsAnonymous" + - $ref: "#/components/schemas/QuestionnaireIsAllowingMultipleResponses" + - $ref: "#/components/schemas/QuestionnaireIsPublished" - properties: is_targeting_me: type: boolean @@ -544,7 +544,7 @@ components: questionnaires: type: array items: - $ref: '#/components/schemas/QuestionnaireSummary' + $ref: "#/components/schemas/QuestionnaireSummary" required: - page_max - questionnaires @@ -584,7 +584,7 @@ components: type: object properties: response_viewable_by: - $ref: '#/components/schemas/ResShareType' + $ref: "#/components/schemas/ResShareType" required: - response_viewable_by QuestionnaireIsAnonymous: @@ -637,9 +637,9 @@ components: type: object properties: targets: - $ref: '#/components/schemas/UsersAndGroups' + $ref: "#/components/schemas/UsersAndGroups" admins: - $ref: '#/components/schemas/UsersAndGroups' + $ref: "#/components/schemas/UsersAndGroups" required: - targets - admins @@ -647,7 +647,7 @@ components: type: object properties: respondents: - $ref: '#/components/schemas/Users' + $ref: "#/components/schemas/Users" required: - respondents QuestionnaireHasMyResponse: @@ -664,12 +664,12 @@ components: 自分に対するリマインドが有効かどうか。ユーザーが対象者でありかつ回答していない場合、この値がtrueであればリマインドが送信される。 NewQuestion: allOf: - - $ref: '#/components/schemas/QuestionBase' - - $ref: '#/components/schemas/QuestionSettingsByType' + - $ref: "#/components/schemas/QuestionBase" + - $ref: "#/components/schemas/QuestionSettingsByType" Question: allOf: - - $ref: '#/components/schemas/QuestionBase' - - $ref: '#/components/schemas/QuestionSettingsByType' + - $ref: "#/components/schemas/QuestionBase" + - $ref: "#/components/schemas/QuestionSettingsByType" - properties: questionID: type: integer @@ -683,7 +683,7 @@ components: Questions: type: array items: - $ref: '#/components/schemas/Question' + $ref: "#/components/schemas/Question" QuestionBase: type: object properties: @@ -704,15 +704,15 @@ components: - questionnaireID QuestionSettingsByType: oneOf: - - $ref: '#/components/schemas/QuestionSettingsText' - - $ref: '#/components/schemas/QuestionSettingsTextLong' - - $ref: '#/components/schemas/QuestionSettingsNumber' - - $ref: '#/components/schemas/QuestionSettingsSingleChoice' - - $ref: '#/components/schemas/QuestionSettingsMultipleChoice' - - $ref: '#/components/schemas/QuestionSettingsScale' + - $ref: "#/components/schemas/QuestionSettingsText" + - $ref: "#/components/schemas/QuestionSettingsTextLong" + - $ref: "#/components/schemas/QuestionSettingsNumber" + - $ref: "#/components/schemas/QuestionSettingsSingleChoice" + - $ref: "#/components/schemas/QuestionSettingsMultipleChoice" + - $ref: "#/components/schemas/QuestionSettingsScale" QuestionSettingsText: allOf: - - $ref: '#/components/schemas/QuestionTypeText' + - $ref: "#/components/schemas/QuestionTypeText" - type: object properties: maxLength: @@ -721,7 +721,7 @@ components: - maxLength QuestionSettingsTextLong: allOf: - - $ref: '#/components/schemas/QuestionTypeTextLong' + - $ref: "#/components/schemas/QuestionTypeTextLong" - type: object properties: maxLength: @@ -730,7 +730,7 @@ components: - maxLength QuestionSettingsNumber: allOf: - - $ref: '#/components/schemas/QuestionTypeNumber' + - $ref: "#/components/schemas/QuestionTypeNumber" - type: object properties: minValue: @@ -742,7 +742,7 @@ components: - maxValue QuestionSettingsSingleChoice: allOf: - - $ref: '#/components/schemas/QuestionTypeSingleChoice' + - $ref: "#/components/schemas/QuestionTypeSingleChoice" - type: object properties: options: @@ -753,7 +753,7 @@ components: - options QuestionSettingsMultipleChoice: allOf: - - $ref: '#/components/schemas/QuestionTypeMultipleChoice' + - $ref: "#/components/schemas/QuestionTypeMultipleChoice" - type: object properties: options: @@ -764,7 +764,7 @@ components: - options QuestionSettingsScale: allOf: - - $ref: '#/components/schemas/QuestionTypeScale' + - $ref: "#/components/schemas/QuestionTypeScale" - type: object properties: minValue: @@ -784,13 +784,13 @@ components: body: type: array items: - $ref: '#/components/schemas/ResponseBody' + $ref: "#/components/schemas/ResponseBody" required: - is_draft - body Response: allOf: - - $ref: '#/components/schemas/QuestionnaireID' + - $ref: "#/components/schemas/QuestionnaireID" - type: object properties: responseID: @@ -806,22 +806,22 @@ components: - responseID - submitted_at - modified_at - - $ref: '#/components/schemas/NewResponse' + - $ref: "#/components/schemas/NewResponse" Responses: type: array items: - $ref: '#/components/schemas/Response' + $ref: "#/components/schemas/Response" ResponseBody: oneOf: - - $ref: '#/components/schemas/ResponseSettingsText' - - $ref: '#/components/schemas/ResponseSettingsTextLong' - - $ref: '#/components/schemas/ResponseSettingsNumber' - - $ref: '#/components/schemas/ResponseSettingsSingleChoice' - - $ref: '#/components/schemas/ResponseSettingsMultipleChoice' - - $ref: '#/components/schemas/ResponseSettingsScale' + - $ref: "#/components/schemas/ResponseSettingsText" + - $ref: "#/components/schemas/ResponseSettingsTextLong" + - $ref: "#/components/schemas/ResponseSettingsNumber" + - $ref: "#/components/schemas/ResponseSettingsSingleChoice" + - $ref: "#/components/schemas/ResponseSettingsMultipleChoice" + - $ref: "#/components/schemas/ResponseSettingsScale" ResponseSettingsText: allOf: - - $ref: '#/components/schemas/QuestionTypeText' + - $ref: "#/components/schemas/QuestionTypeText" - type: object properties: text: @@ -830,7 +830,7 @@ components: - text ResponseSettingsTextLong: allOf: - - $ref: '#/components/schemas/QuestionTypeTextLong' + - $ref: "#/components/schemas/QuestionTypeTextLong" - type: object properties: textLong: @@ -839,7 +839,7 @@ components: - textLong ResponseSettingsNumber: allOf: - - $ref: '#/components/schemas/QuestionTypeNumber' + - $ref: "#/components/schemas/QuestionTypeNumber" - type: object properties: number: @@ -848,7 +848,7 @@ components: - number ResponseSettingsSingleChoice: allOf: - - $ref: '#/components/schemas/QuestionTypeSingleChoice' + - $ref: "#/components/schemas/QuestionTypeSingleChoice" - type: object properties: index: @@ -859,7 +859,7 @@ components: - index ResponseSettingsMultipleChoice: allOf: - - $ref: '#/components/schemas/QuestionTypeMultipleChoice' + - $ref: "#/components/schemas/QuestionTypeMultipleChoice" - type: object properties: indexes: @@ -872,7 +872,7 @@ components: - indexes ResponseSettingsScale: allOf: - - $ref: '#/components/schemas/QuestionTypeScale' + - $ref: "#/components/schemas/QuestionTypeScale" - type: object properties: number: @@ -939,22 +939,22 @@ components: body: type: array items: - $ref: '#/components/schemas/ResultBody' + $ref: "#/components/schemas/ResultBody" required: - questionnaireID - responseCount - body ResultBody: oneOf: - - $ref: '#/components/schemas/ResultSettingsText' - - $ref: '#/components/schemas/ResultSettingsTextLong' - - $ref: '#/components/schemas/ResultSettingsNumber' - - $ref: '#/components/schemas/ResultSettingsSingleChoice' - - $ref: '#/components/schemas/ResultSettingsMultipleChoice' - - $ref: '#/components/schemas/ResultSettingsScale' + - $ref: "#/components/schemas/ResultSettingsText" + - $ref: "#/components/schemas/ResultSettingsTextLong" + - $ref: "#/components/schemas/ResultSettingsNumber" + - $ref: "#/components/schemas/ResultSettingsSingleChoice" + - $ref: "#/components/schemas/ResultSettingsMultipleChoice" + - $ref: "#/components/schemas/ResultSettingsScale" ResultSettingsText: allOf: - - $ref: '#/components/schemas/QuestionTypeText' + - $ref: "#/components/schemas/QuestionTypeText" - type: object properties: answers: @@ -967,7 +967,7 @@ components: - texts ResultSettingsTextLong: allOf: - - $ref: '#/components/schemas/QuestionTypeTextLong' + - $ref: "#/components/schemas/QuestionTypeTextLong" - type: object properties: answers: @@ -980,26 +980,26 @@ components: - textLongs ResultSettingsNumber: allOf: - - $ref: '#/components/schemas/QuestionTypeNumber' - - $ref: '#/components/schemas/ResultSettingsAnswerCountPerNumber' + - $ref: "#/components/schemas/QuestionTypeNumber" + - $ref: "#/components/schemas/ResultSettingsAnswerCountPerNumber" description: | 数値ごとの回答数の配列 ResultSettingsSingleChoice: allOf: - - $ref: '#/components/schemas/QuestionTypeSingleChoice' - - $ref: '#/components/schemas/ResultSettingsAnswerCountPerIndex' + - $ref: "#/components/schemas/QuestionTypeSingleChoice" + - $ref: "#/components/schemas/ResultSettingsAnswerCountPerIndex" description: | 選択肢ごとの回答数の配列 ResultSettingsMultipleChoice: allOf: - - $ref: '#/components/schemas/QuestionTypeMultipleChoice' - - $ref: '#/components/schemas/ResultSettingsAnswerCountPerIndex' + - $ref: "#/components/schemas/QuestionTypeMultipleChoice" + - $ref: "#/components/schemas/ResultSettingsAnswerCountPerIndex" description: | 選択肢ごとの回答数の配列 ResultSettingsScale: allOf: - - $ref: '#/components/schemas/QuestionTypeScale' - - $ref: '#/components/schemas/ResultSettingsAnswerCountPerNumber' + - $ref: "#/components/schemas/QuestionTypeScale" + - $ref: "#/components/schemas/ResultSettingsAnswerCountPerNumber" description: | 数値ごとの回答数の配列 ResultSettingsAnswerCountPerNumber: @@ -1040,9 +1040,9 @@ components: type: object properties: users: - $ref: '#/components/schemas/Users' + $ref: "#/components/schemas/Users" groups: - $ref: '#/components/schemas/Groups' + $ref: "#/components/schemas/Groups" required: - users - groups @@ -1065,8 +1065,8 @@ components: type: oauth2 flows: authorizationCode: - authorizationUrl: 'https://q.trap.jp/api/v3/oauth2/authorize' - tokenUrl: 'https://q.trap.jp/api/v3/oauth2/token' + authorizationUrl: "https://q.trap.jp/api/v3/oauth2/authorize" + tokenUrl: "https://q.trap.jp/api/v3/oauth2/token" scopes: write: allows modifying resources read: allows reading resources From bd6a691670701661a8baed45952033ffb038b8b1 Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 22:30:29 +0900 Subject: [PATCH 37/77] =?UTF-8?q?[chore]=20swagger.yaml=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20QuestionnaireIsRemindEnabled=E3=82=92object?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4=20QuestionnaireIsRemindEnabled?= =?UTF-8?q?=E3=81=AE=E5=91=BD=E5=90=8D=E3=82=92=E6=94=B9=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index e418b704..4664b863 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -135,7 +135,7 @@ paths: #TODO 変数の命名を確認する content: application/json: schema: - $ref: "#/components/schemas/QuestionnaireMyRemindStatus" + $ref: "#/components/schemas/QuestionnaireIsRemindEnabled" "400": description: アンケートのIDが無効です "404": @@ -154,7 +154,7 @@ paths: #TODO 変数の命名を確認する content: application/json: schema: - $ref: "#/components/schemas/QuestionnaireMyRemindStatus" + $ref: "#/components/schemas/QuestionnaireIsRemindEnabled" responses: "200": description: 正常に変更できました。 @@ -658,10 +658,15 @@ components: description: 回答済みあるいは下書きが存在する required: - has_response - QuestionnaireMyRemindStatus: - type: boolean - description: | - 自分に対するリマインドが有効かどうか。ユーザーが対象者でありかつ回答していない場合、この値がtrueであればリマインドが送信される。 + QuestionnaireIsRemindEnabled: + type: object + properties: + is_remind_enabled: + type: boolean + description: | + 自分に対するリマインドが有効かどうか。ユーザーが対象者でありかつ回答していない場合、この値がtrueであればリマインドが送信される。 + required: + - is_remind_enabled NewQuestion: allOf: - $ref: "#/components/schemas/QuestionBase" From 0e9c09edf3a23341c312e989eeb7a93131a8c5e5 Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 22:59:12 +0900 Subject: [PATCH 38/77] =?UTF-8?q?[chore]=20swagger.yaml=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20properties=E3=82=92snake=5Fcase=E3=81=AB=E7=B5=B1?= =?UTF-8?q?=E4=B8=80=20required=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 69 +++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 4664b863..71d24a44 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -551,11 +551,11 @@ components: QuestionnaireID: type: object properties: - questionnaireID: + questionnaire_id: type: integer example: 1 required: - - questionnaireID + - questionnaire_id QuestionnaireTitle: type: object properties: @@ -676,14 +676,14 @@ components: - $ref: "#/components/schemas/QuestionBase" - $ref: "#/components/schemas/QuestionSettingsByType" - properties: - questionID: + question_id: type: integer example: 1 created_at: type: string format: date-time required: - - questionID + - question_id - created_at Questions: type: array @@ -692,7 +692,7 @@ components: QuestionBase: type: object properties: - questionnaireID: + questionnaire_id: type: integer example: 1 title: @@ -702,11 +702,10 @@ components: is_required: type: boolean required: - - questionType + - questionnaire_id - title - description - is_required - - questionnaireID QuestionSettingsByType: oneOf: - $ref: "#/components/schemas/QuestionSettingsText" @@ -798,7 +797,7 @@ components: - $ref: "#/components/schemas/QuestionnaireID" - type: object properties: - responseID: + response_id: type: integer example: 1 submitted_at: @@ -808,7 +807,7 @@ components: type: string format: date-time required: - - responseID + - response_id - submitted_at - modified_at - $ref: "#/components/schemas/NewResponse" @@ -887,58 +886,58 @@ components: QuestionTypeText: type: object properties: - questionType: + question_type: type: string enum: [Text] required: - - questionType + - question_type QuestionTypeTextLong: type: object properties: - questionType: + question_type: type: string enum: [TextLong] required: - - questionType + - question_type QuestionTypeNumber: type: object properties: - questionType: + question_type: type: string enum: [Number] required: - - questionType + - question_type QuestionTypeSingleChoice: type: object properties: - questionType: + question_type: type: string enum: [SingleChoice] required: - - questionType + - question_type QuestionTypeMultipleChoice: type: object properties: - questionType: + question_type: type: string enum: [MultipleChoice] required: - - questionType + - question_type QuestionTypeScale: type: object properties: - questionType: + question_type: type: string enum: [Scale] required: - - questionType + - question_type Result: type: object properties: - questionnaireID: + questionnaire_id: type: integer example: 1 - responseCount: + response_count: type: integer example: 1 body: @@ -946,8 +945,8 @@ components: items: $ref: "#/components/schemas/ResultBody" required: - - questionnaireID - - responseCount + - questionnaire_id + - response_count - body ResultBody: oneOf: @@ -969,7 +968,7 @@ components: description: | 回答文の配列 required: - - texts + - answers ResultSettingsTextLong: allOf: - $ref: "#/components/schemas/QuestionTypeTextLong" @@ -982,7 +981,7 @@ components: description: | 回答文の配列 required: - - textLongs + - answers ResultSettingsNumber: allOf: - $ref: "#/components/schemas/QuestionTypeNumber" @@ -1010,37 +1009,37 @@ components: ResultSettingsAnswerCountPerNumber: type: object properties: - answerCountPerNumber: #TODO: 配列なのに複数形じゃないの気になる + answer_count_per_number: #TODO: 配列なのに複数形じゃないの気になる type: array items: type: object properties: number: type: number - answerCount: + answer_count: type: number required: - number - - answerCount + - answer_count required: - - indexes + - answer_count_per_number ResultSettingsAnswerCountPerIndex: type: object properties: - AnswerCountPerIndex: #TODO: 配列なのに複数形じゃないの気になるv2 + answer_count_per_index: #TODO: 配列なのに複数形じゃないの気になるv2 type: array items: type: object properties: index: type: number - answerCount: + answer_count: type: number required: - index - - answerCount + - answer_count required: - - indexes + - answer_count_per_index UsersAndGroups: type: object properties: From 553790e67eee043a08c1ab10d10f0b693ae9fb87 Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 23:02:29 +0900 Subject: [PATCH 39/77] =?UTF-8?q?[chore]=20swagger.yaml=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20answer=5Fcounts=5Fper=5Findex=E3=81=ABproperty?= =?UTF-8?q?=E5=90=8D=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 71d24a44..357e567b 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -1009,7 +1009,7 @@ components: ResultSettingsAnswerCountPerNumber: type: object properties: - answer_count_per_number: #TODO: 配列なのに複数形じゃないの気になる + answer_counts_per_number: type: array items: type: object @@ -1026,7 +1026,7 @@ components: ResultSettingsAnswerCountPerIndex: type: object properties: - answer_count_per_index: #TODO: 配列なのに複数形じゃないの気になるv2 + answer_counts_per_index: type: array items: type: object From 0ba240e9e4095acfd75246794b053464fa096cb0 Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 23:03:26 +0900 Subject: [PATCH 40/77] =?UTF-8?q?[chore]=20swagger.yaml=20=E5=89=8D?= =?UTF-8?q?=E3=82=B3=E3=83=9F=E3=83=83=E3=83=88=E3=81=A7=E3=81=AErequired?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E3=83=9F=E3=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 357e567b..364cebc6 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -1022,7 +1022,7 @@ components: - number - answer_count required: - - answer_count_per_number + - answer_counts_per_number ResultSettingsAnswerCountPerIndex: type: object properties: @@ -1039,7 +1039,7 @@ components: - index - answer_count required: - - answer_count_per_index + - answer_counts_per_index UsersAndGroups: type: object properties: From fd9076632b273b2dc13cc3f4f49e26a1c65619a3 Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 23:12:23 +0900 Subject: [PATCH 41/77] =?UTF-8?q?[chore]=20swagger.yaml=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20ResultSettingsAnswerCountPer=E3=81=AB=E9=96=A2?= =?UTF-8?q?=E3=81=99=E3=82=8B=E7=B4=B0=E3=81=8B=E3=81=AA=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E3=81=AA=E3=81=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 364cebc6..d89a9568 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -15,10 +15,10 @@ security: - application: - read - write -tags: +tags: # TODO: リソースの分類でつけなおす - name: questionnaire - name: response -paths: #TODO 変数の命名を確認する +paths: # TODO 変数の命名を確認する /questionnaires: # TODO: 取得個数可変でもいいかも get: operationId: getQuestionnaires @@ -419,7 +419,7 @@ components: traQ ID(ex:mazrean) schema: type: string - schemas: # TODO: description, example, requiredを確認する + schemas: # TODO: description, exampleを確認する AnsweredType: type: string description: アンケート検索時に回答済みかの状態での絞り込み @@ -965,8 +965,8 @@ components: type: array items: type: string - description: | - 回答文の配列 + description: | + 回答文の配列 required: - answers ResultSettingsTextLong: @@ -978,35 +978,35 @@ components: type: array items: type: string - description: | - 回答文の配列 + description: | + 回答文の配列 required: - answers ResultSettingsNumber: allOf: - $ref: "#/components/schemas/QuestionTypeNumber" - - $ref: "#/components/schemas/ResultSettingsAnswerCountPerNumber" + - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerNumber" description: | 数値ごとの回答数の配列 ResultSettingsSingleChoice: allOf: - $ref: "#/components/schemas/QuestionTypeSingleChoice" - - $ref: "#/components/schemas/ResultSettingsAnswerCountPerIndex" + - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerIndex" description: | 選択肢ごとの回答数の配列 ResultSettingsMultipleChoice: allOf: - $ref: "#/components/schemas/QuestionTypeMultipleChoice" - - $ref: "#/components/schemas/ResultSettingsAnswerCountPerIndex" + - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerIndex" description: | 選択肢ごとの回答数の配列 ResultSettingsScale: allOf: - $ref: "#/components/schemas/QuestionTypeScale" - - $ref: "#/components/schemas/ResultSettingsAnswerCountPerNumber" + - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerNumber" description: | 数値ごとの回答数の配列 - ResultSettingsAnswerCountPerNumber: + ResultSettingsAnswerCountsPerNumber: type: object properties: answer_counts_per_number: @@ -1023,7 +1023,7 @@ components: - answer_count required: - answer_counts_per_number - ResultSettingsAnswerCountPerIndex: + ResultSettingsAnswerCountsPerIndex: type: object properties: answer_counts_per_index: From e06e7e2d272a6d1efa08a015129352d7a99127e1 Mon Sep 17 00:00:00 2001 From: rei <107461411+reiroop@users.noreply.github.com> Date: Tue, 12 Dec 2023 23:18:36 +0900 Subject: [PATCH 42/77] Update docs/swagger/swagger.yaml Co-authored-by: cp20 <47262658+cp-20@users.noreply.github.com> --- docs/swagger/swagger.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index d89a9568..9b7d35ca 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -778,7 +778,6 @@ components: required: - minValue - maxValue - NewResponse: type: object properties: From 144dc2b0678743bd4e66ac3bce4cb081334eb4b7 Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 12 Dec 2023 23:58:58 +0900 Subject: [PATCH 43/77] =?UTF-8?q?[chore]=20swagger.yaml=20maxLength,=20min?= =?UTF-8?q?Value,=20maxLength=E3=82=92required=E3=81=8B=E3=82=89=E5=A4=96?= =?UTF-8?q?=E3=81=97=E3=80=81snake=5Fcase=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 9b7d35ca..e1d05654 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -719,31 +719,24 @@ components: - $ref: "#/components/schemas/QuestionTypeText" - type: object properties: - maxLength: + max_length: type: integer - required: - - maxLength QuestionSettingsTextLong: allOf: - $ref: "#/components/schemas/QuestionTypeTextLong" - type: object properties: - maxLength: + max_length: type: number - required: - - maxLength QuestionSettingsNumber: allOf: - $ref: "#/components/schemas/QuestionTypeNumber" - type: object properties: - minValue: + min_value: type: integer - maxValue: + max_value: type: integer - required: - - minValue - - maxValue QuestionSettingsSingleChoice: allOf: - $ref: "#/components/schemas/QuestionTypeSingleChoice" @@ -771,13 +764,13 @@ components: - $ref: "#/components/schemas/QuestionTypeScale" - type: object properties: - minValue: + min_value: type: integer - maxValue: + max_value: type: integer required: - - minValue - - maxValue + - min_value + - max_value NewResponse: type: object properties: From e097a4e1d676b574e69fa72c6eed80d57b083a12 Mon Sep 17 00:00:00 2001 From: rei Date: Thu, 14 Dec 2023 13:54:22 +0900 Subject: [PATCH 44/77] =?UTF-8?q?[chore]=20swagger.yaml=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20responsesWithQuestionnaireInfo=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E6=88=90=E3=81=97=E3=80=81/responses/myResponses=E3=81=AE?= =?UTF-8?q?=E3=83=AC=E3=82=B9=E3=83=9D=E3=83=B3=E3=82=B9=E3=81=AB=20Questi?= =?UTF-8?q?onnaireSummary=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 43 +++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index e1d05654..cd5afb97 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -325,7 +325,7 @@ paths: # TODO 変数の命名を確認する schema: type: array items: - $ref: "#/components/schemas/Responses" + $ref: "#/components/schemas/ResponsesWithQuestionnaireInfo" "500": description: 自分の回答のリストを取得できませんでした components: @@ -507,31 +507,28 @@ components: - $ref: "#/components/schemas/QuestionnaireIsAnonymous" - $ref: "#/components/schemas/QuestionnaireIsAllowingMultipleResponses" - $ref: "#/components/schemas/QuestionnaireIsPublished" + - $ref: "#/components/schemas/QuestionnaireIsTargetingMe" + - $ref: "#/components/schemas/QuestionnaireCreatedAt" + - $ref: "#/components/schemas/QuestionnaireModifiedAt" - properties: - is_targeting_me: - type: boolean - example: true - description: | - 自分がターゲットになっているかどうか - responded_at: - type: string - format: date-time has_my_draft: type: boolean description: 下書きが存在する has_my_response: type: boolean description: 回答が存在する + responded_date_time_by_me: + type: string + format: date-time all_responded: type: boolean example: true description: | すべての対象者が回答済みの場合 true を返す。それ以外は false を返す。 (対象者が存在しない場合は true を返す) required: - - is_targeting_me - - responded_at - has_my_draft - has_my_response + - responded_date_time_by_me - all_responded QuestionnaireList: type: object @@ -617,6 +614,16 @@ components: アンケートが公開されているかどうか required: - is_published + QuestionnaireIsTargetingMe: + type: object + properties: + is_targeting_me: + type: boolean + example: true + description: | + 自分がターゲットになっているかどうか + required: + - is_targeting_me QuestionnaireCreatedAt: type: object properties: @@ -807,6 +814,20 @@ components: type: array items: $ref: "#/components/schemas/Response" + 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" ResponseBody: oneOf: - $ref: "#/components/schemas/ResponseSettingsText" From a07d42bdb2ab1443b4dd52199dac94b6cf2862bb Mon Sep 17 00:00:00 2001 From: rei Date: Fri, 15 Dec 2023 14:04:41 +0900 Subject: [PATCH 45/77] =?UTF-8?q?[chore]=20swagger.yaml=20QuestionSettings?= =?UTF-8?q?Scale=E3=81=ABmin=5Flabel=E3=81=A8max=5Flabel=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index cd5afb97..93a9971b 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -775,6 +775,10 @@ components: type: integer max_value: type: integer + min_label: + type: string + max_label: + type: string required: - min_value - max_value From 38344f8569171fca6c4c6ca8efebe842d463d171 Mon Sep 17 00:00:00 2001 From: rei Date: Fri, 15 Dec 2023 14:07:16 +0900 Subject: [PATCH 46/77] =?UTF-8?q?[chore]=20swagger.yaml=20=20Questionnaire?= =?UTF-8?q?ResponseDueDateTime=E3=81=AEresponse=5Fdue=5Fdate=5Ftime?= =?UTF-8?q?=E3=82=92optional=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 93a9971b..2df1b15d 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -575,8 +575,9 @@ components: response_due_date_time: type: string format: date-time - required: - - response_due_date_time + example: 2020-01-01T00:00:00+09:00 + description: | + 回答期限。この日時を過ぎたら回答できなくなる。nullの場合は回答期限なし。 QuestionnaireResponseViewableBy: type: object properties: From 9ed6e837c94b7000b4ca1e3b34049ebc904c5a2f Mon Sep 17 00:00:00 2001 From: kaitoyama Date: Fri, 15 Dec 2023 17:30:58 +0900 Subject: [PATCH 47/77] try to add migrate --- go.mod | 10 ++++++---- go.sum | 11 +++++++++++ main.go | 2 +- model/current.go | 26 ++++++++++++++++++++++++++ model/db.go | 27 ++++++++++++++++++++------- model/db_test.go | 4 ++-- 6 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 model/current.go diff --git a/go.mod b/go.mod index bc570d66..5358018d 100644 --- a/go.mod +++ b/go.mod @@ -50,17 +50,19 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - gorm.io/gorm v1.22.5 + gorm.io/gorm v1.25.5 ) require ( - github.com/jinzhu/now v1.1.4 // indirect - gorm.io/driver/mysql v1.2.3 + github.com/jinzhu/now v1.1.5 // indirect + gorm.io/driver/mysql v1.5.2 ) require ( - github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/prometheus/client_golang v1.12.1 gopkg.in/guregu/null.v4 v4.0.0 gorm.io/plugin/prometheus v0.0.0-20210820101226-2a49866f83ee ) + +require github.com/go-gormigrate/gormigrate/v2 v2.1.1 // indirect diff --git a/go.sum b/go.sum index 3562645f..83e0cc26 100644 --- a/go.sum +++ b/go.sum @@ -85,6 +85,8 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gormigrate/gormigrate/v2 v2.1.1 h1:eGS0WTFRV30r103lU8JNXY27KbviRnqqIDobW3EV3iY= +github.com/go-gormigrate/gormigrate/v2 v2.1.1/go.mod h1:L7nJ620PFDKei9QOhJzqA8kRCk+E3UbV2f5gv+1ndLc= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -101,6 +103,8 @@ github.com/go-playground/validator/v10 v10.10.1 h1:uA0+amWMiglNZKZ9FJRKUAe9U3RX9 github.com/go-playground/validator/v10 v10.10.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -191,6 +195,8 @@ github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/ github.com/jinzhu/now v1.1.3/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jinzhu/now v1.1.4 h1:tHnRBy1i5F2Dh8BAFxqFzxKqqvezXrL2OW1TnX+Mlas= github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -705,10 +711,15 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/mysql v1.2.3 h1:cZqzlOfg5Kf1VIdLC1D9hT6Cy9BgxhExLj/2tIgUe7Y= gorm.io/driver/mysql v1.2.3/go.mod h1:qsiz+XcAyMrS6QY+X3M9R6b/lKM1imKmcuK9kac5LTo= +gorm.io/driver/mysql v1.5.2 h1:QC2HRskSE75wBuOxe0+iCkyJZ+RqpudsQtqkp+IMuXs= +gorm.io/driver/mysql v1.5.2/go.mod h1:pQLhh1Ut/WUAySdTHwBpBv6+JKcj+ua4ZFx1QQTBzb8= gorm.io/gorm v1.21.13/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= gorm.io/gorm v1.22.4/go.mod h1:1aeVC+pe9ZmvKZban/gW4QPra7PRoTEssyc922qCAkk= gorm.io/gorm v1.22.5 h1:lYREBgc02Be/5lSCTuysZZDb6ffL2qrat6fg9CFbvXU= gorm.io/gorm v1.22.5/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= +gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gorm.io/plugin/prometheus v0.0.0-20210820101226-2a49866f83ee h1:UhePWayrSEXncx1x7UdBNvUfbuxrQOk9LV44glIJElQ= gorm.io/plugin/prometheus v0.0.0-20210820101226-2a49866f83ee/go.mod h1:tu0ajC4OlzwAK6aSL4NQjAvvbBeWcVbv2X285icuEm0= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/main.go b/main.go index ced14f98..f5457edc 100644 --- a/main.go +++ b/main.go @@ -34,7 +34,7 @@ func main() { panic(err) } - err = model.Migrate() + _, err = model.Migrate() if err != nil { panic(err) } diff --git a/model/current.go b/model/current.go new file mode 100644 index 00000000..daf90934 --- /dev/null +++ b/model/current.go @@ -0,0 +1,26 @@ +package model + +import ( + "github.com/go-gormigrate/gormigrate/v2" +) + +// Migrations is all db migrations +func Migrations() []*gormigrate.Migration { + return []*gormigrate.Migration{ + {}, + } +} + +func AllTables() []interface{} { + return []interface{}{ + &Questionnaires{}, + &Questions{}, + &Respondents{}, + &Responses{}, + &Administrators{}, + &Options{}, + &ScaleLabels{}, + &Targets{}, + &Validations{}, + } +} diff --git a/model/db.go b/model/db.go index 918f99fd..4dac5e47 100755 --- a/model/db.go +++ b/model/db.go @@ -4,6 +4,7 @@ import ( "fmt" "os" + "github.com/go-gormigrate/gormigrate/v2" "gorm.io/driver/mysql" "gorm.io/gorm" "gorm.io/gorm/logger" @@ -83,12 +84,24 @@ func EstablishConnection(isProduction bool) error { return nil } -// Migrate DBのMigrationを行う -func Migrate() error { - err := db.AutoMigrate(allTables...) - if err != nil { - return fmt.Errorf("failed in table's migration: %w", err) - } +func Migrate() (init bool, err error) { + m := gormigrate.New(db, gormigrate.DefaultOptions, Migrations()) - return nil + m.InitSchema(func(db *gorm.DB) error { + init = true + + return db.AutoMigrate(allTables...) + }) + err = m.Migrate() + return } + +// Migrate DBのMigrationを行う +// func Migrate() error { +// err := db.AutoMigrate(allTables...) +// if err != nil { +// return fmt.Errorf("failed in table's migration: %w", err) +// } + +// return nil +// } diff --git a/model/db_test.go b/model/db_test.go index 57e1a66a..7de6d521 100644 --- a/model/db_test.go +++ b/model/db_test.go @@ -23,14 +23,14 @@ var ( targetImpl = new(Target) ) -//TestMain テストのmain +// TestMain テストのmain func TestMain(m *testing.M) { err := EstablishConnection(true) if err != nil { panic(err) } - err = Migrate() + _, err = Migrate() if err != nil { panic(err) } From 51f1ae69a4a54bce1a58a978a7c9c02f8c9a0e15 Mon Sep 17 00:00:00 2001 From: kaitoyama Date: Fri, 15 Dec 2023 22:36:22 +0900 Subject: [PATCH 48/77] move AllTables() to current --- model/db.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/model/db.go b/model/db.go index 4dac5e47..43a749a4 100755 --- a/model/db.go +++ b/model/db.go @@ -11,20 +11,7 @@ import ( "gorm.io/plugin/prometheus" ) -var ( - db *gorm.DB - allTables = []interface{}{ - Questionnaires{}, - Questions{}, - Respondents{}, - Responses{}, - Administrators{}, - Options{}, - ScaleLabels{}, - Targets{}, - Validations{}, - } -) +var db *gorm.DB // EstablishConnection DBと接続 func EstablishConnection(isProduction bool) error { @@ -90,7 +77,7 @@ func Migrate() (init bool, err error) { m.InitSchema(func(db *gorm.DB) error { init = true - return db.AutoMigrate(allTables...) + return db.AutoMigrate(AllTables()...) }) err = m.Migrate() return From bb6d62960c3fa72a3551dbe5193f8073f1ac8dcd Mon Sep 17 00:00:00 2001 From: rei Date: Sat, 16 Dec 2023 00:02:06 +0900 Subject: [PATCH 49/77] [chore] Update swagger.yaml Refactor ResultSettings schemas in swagger.yaml --- docs/swagger/swagger.yaml | 68 ++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 41 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 2df1b15d..31a45256 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -977,87 +977,73 @@ components: ResultSettingsText: allOf: - $ref: "#/components/schemas/QuestionTypeText" - - type: object - properties: - answers: - type: array - items: - type: string - description: | - 回答文の配列 - required: - - answers + - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerString" + description: | + 回答文ごとの回答数の配列 ResultSettingsTextLong: allOf: - $ref: "#/components/schemas/QuestionTypeTextLong" - - type: object - properties: - answers: - type: array - items: - type: string - description: | - 回答文の配列 - required: - - answers + - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerString" + description: | + 回答文ごとの回答数の配列 ResultSettingsNumber: allOf: - $ref: "#/components/schemas/QuestionTypeNumber" - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerNumber" - description: | - 数値ごとの回答数の配列 + description: | + 数値ごとの回答数の配列 ResultSettingsSingleChoice: allOf: - $ref: "#/components/schemas/QuestionTypeSingleChoice" - - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerIndex" - description: | - 選択肢ごとの回答数の配列 + - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerNumber" + description: | + 選択肢ごとの回答数の配列 ResultSettingsMultipleChoice: allOf: - $ref: "#/components/schemas/QuestionTypeMultipleChoice" - - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerIndex" - description: | - 選択肢ごとの回答数の配列 + - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerNumber" + description: | + 選択肢ごとの回答数の配列 ResultSettingsScale: allOf: - $ref: "#/components/schemas/QuestionTypeScale" - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerNumber" - description: | - 数値ごとの回答数の配列 - ResultSettingsAnswerCountsPerNumber: + description: | + 数値ごとの回答数の配列 + ResultSettingsAnswerCountsPerString: type: object properties: - answer_counts_per_number: + answer_counts_per_string: type: array items: type: object properties: - number: - type: number + answer: + type: string answer_count: type: number required: - - number + - answer - answer_count required: - - answer_counts_per_number - ResultSettingsAnswerCountsPerIndex: + - answer_counts_per_string + ResultSettingsAnswerCountsPerNumber: type: object properties: - answer_counts_per_index: + answer_counts_per_number: type: array items: type: object properties: - index: + answer: type: number answer_count: type: number required: - - index + - answer - answer_count required: - - answer_counts_per_index + - answer_counts_per_number UsersAndGroups: type: object properties: From 4a57c8b9c523844ce1760731dfa7b4e9979d74f0 Mon Sep 17 00:00:00 2001 From: rei Date: Sat, 16 Dec 2023 02:10:02 +0900 Subject: [PATCH 50/77] =?UTF-8?q?[chore]=20swagger.yaml=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20NewResponse=E3=81=ABrespondent=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=20ResponseBody,=20ResultBody=E3=81=AEproperties?= =?UTF-8?q?=E3=82=92=E6=95=B4=E7=90=86=20description,=20example=E3=82=92?= =?UTF-8?q?=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 261 +++++++++++++++++++++----------------- 1 file changed, 143 insertions(+), 118 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 31a45256..cf9a64a9 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -631,6 +631,7 @@ components: created_at: type: string format: date-time + example: 2020-01-01T00:00:00+09:00 required: - created_at QuestionnaireModifiedAt: @@ -639,6 +640,7 @@ components: modified_at: type: string format: date-time + example: 2020-01-01T00:00:00+09:00 required: - modified_at QuestionnaireTargetsAndAdmins: @@ -690,6 +692,7 @@ components: created_at: type: string format: date-time + example: 2020-01-01T00:00:00+09:00 required: - question_id - created_at @@ -707,13 +710,15 @@ components: type: string description: type: string - is_required: + is_answer_required: type: boolean + description: | + 回答必須かどうか required: - questionnaire_id - title - description - - is_required + - is_answer_required QuestionSettingsByType: oneOf: - $ref: "#/components/schemas/QuestionSettingsText" @@ -783,9 +788,59 @@ components: required: - min_value - max_value + QuestionTypeText: + type: object + properties: + question_type: + type: string + enum: [Text] + required: + - question_type + QuestionTypeTextLong: + type: object + properties: + question_type: + type: string + enum: [TextLong] + required: + - question_type + QuestionTypeNumber: + type: object + properties: + question_type: + type: string + enum: [Number] + required: + - question_type + QuestionTypeSingleChoice: + type: object + properties: + question_type: + type: string + enum: [SingleChoice] + required: + - question_type + QuestionTypeMultipleChoice: + type: object + properties: + question_type: + type: string + enum: [MultipleChoice] + required: + - question_type + QuestionTypeScale: + type: object + properties: + question_type: + type: string + enum: [Scale] + required: + - question_type NewResponse: type: object properties: + respondent: + $ref: "#/components/schemas/TraqId" is_draft: type: boolean example: true @@ -794,6 +849,7 @@ components: items: $ref: "#/components/schemas/ResponseBody" required: + - respondent - is_draft - body Response: @@ -807,9 +863,11 @@ components: 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 - submitted_at @@ -835,120 +893,68 @@ components: - $ref: "#/components/schemas/QuestionnaireIsTargetingMe" ResponseBody: oneOf: - - $ref: "#/components/schemas/ResponseSettingsText" - - $ref: "#/components/schemas/ResponseSettingsTextLong" - - $ref: "#/components/schemas/ResponseSettingsNumber" - - $ref: "#/components/schemas/ResponseSettingsSingleChoice" - - $ref: "#/components/schemas/ResponseSettingsMultipleChoice" - - $ref: "#/components/schemas/ResponseSettingsScale" - ResponseSettingsText: + - $ref: "#/components/schemas/ResponseBodyText" + - $ref: "#/components/schemas/ResponseBodyTextLong" + - $ref: "#/components/schemas/ResponseBodyNumber" + - $ref: "#/components/schemas/ResponseBodySingleChoice" + - $ref: "#/components/schemas/ResponseBodyMultipleChoice" + - $ref: "#/components/schemas/ResponseBodyScale" + ResponseBodyText: allOf: - $ref: "#/components/schemas/QuestionTypeText" - - type: object - properties: - text: - type: string - required: - - text - ResponseSettingsTextLong: + - $ref: "#/components/schemas/ResponseBodyBaseString" + ResponseBodyTextLong: allOf: - $ref: "#/components/schemas/QuestionTypeTextLong" - - type: object - properties: - textLong: - type: string - required: - - textLong - ResponseSettingsNumber: + - $ref: "#/components/schemas/ResponseBodyBaseString" + ResponseBodyNumber: allOf: - $ref: "#/components/schemas/QuestionTypeNumber" - - type: object - properties: - number: - type: number - required: - - number - ResponseSettingsSingleChoice: + - $ref: "#/components/schemas/ResponseBodyBaseNumber" + ResponseBodySingleChoice: allOf: - $ref: "#/components/schemas/QuestionTypeSingleChoice" - - type: object - properties: - index: - type: integer - description: | - 選択肢のインデックス - required: - - index - ResponseSettingsMultipleChoice: + - $ref: "#/components/schemas/ResponseBodyBaseInteger" + - description: | + 選択肢のインデックス + ResponseBodyMultipleChoice: allOf: - $ref: "#/components/schemas/QuestionTypeMultipleChoice" - type: object properties: - indexes: + answers: type: array items: type: integer - description: | - 選択肢のインデックスの配列 + description: | + 選択肢のインデックスの配列 required: - - indexes - ResponseSettingsScale: + - answers + ResponseBodyScale: allOf: - $ref: "#/components/schemas/QuestionTypeScale" - - type: object - properties: - number: - type: integer - required: - - number - QuestionTypeText: - type: object - properties: - question_type: - type: string - enum: [Text] - required: - - question_type - QuestionTypeTextLong: - type: object - properties: - question_type: - type: string - enum: [TextLong] - required: - - question_type - QuestionTypeNumber: + - $ref: "#/components/schemas/ResponseBodyBaseInteger" + ResponseBodyBaseString: type: object properties: - question_type: + answer: type: string - enum: [Number] required: - - question_type - QuestionTypeSingleChoice: + - answer + ResponseBodyBaseNumber: type: object properties: - question_type: - type: string - enum: [SingleChoice] + answer: + type: number required: - - question_type - QuestionTypeMultipleChoice: + - answer + ResponseBodyBaseInteger: type: object properties: - question_type: - type: string - enum: [MultipleChoice] - required: - - question_type - QuestionTypeScale: - type: object - properties: - question_type: - type: string - enum: [Scale] + answer: + type: integer required: - - question_type + - answer Result: type: object properties: @@ -968,52 +974,52 @@ components: - body ResultBody: oneOf: - - $ref: "#/components/schemas/ResultSettingsText" - - $ref: "#/components/schemas/ResultSettingsTextLong" - - $ref: "#/components/schemas/ResultSettingsNumber" - - $ref: "#/components/schemas/ResultSettingsSingleChoice" - - $ref: "#/components/schemas/ResultSettingsMultipleChoice" - - $ref: "#/components/schemas/ResultSettingsScale" - ResultSettingsText: + - $ref: "#/components/schemas/ResultBodyText" + - $ref: "#/components/schemas/ResultBodyTextLong" + - $ref: "#/components/schemas/ResultBodyNumber" + - $ref: "#/components/schemas/ResultBodySingleChoice" + - $ref: "#/components/schemas/ResultBodyMultipleChoice" + - $ref: "#/components/schemas/ResultBodyScale" + ResultBodyText: allOf: - $ref: "#/components/schemas/QuestionTypeText" - - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerString" + - $ref: "#/components/schemas/ResultBodyBaseAnswerCountsPerString" description: | 回答文ごとの回答数の配列 - ResultSettingsTextLong: + ResultBodyTextLong: allOf: - $ref: "#/components/schemas/QuestionTypeTextLong" - - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerString" + - $ref: "#/components/schemas/ResultBodyBaseAnswerCountsPerString" description: | 回答文ごとの回答数の配列 - ResultSettingsNumber: + ResultBodyNumber: allOf: - $ref: "#/components/schemas/QuestionTypeNumber" - - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerNumber" + - $ref: "#/components/schemas/ResultBodyBaseAnswerCountsPerNumber" description: | 数値ごとの回答数の配列 - ResultSettingsSingleChoice: + ResultBodySingleChoice: allOf: - $ref: "#/components/schemas/QuestionTypeSingleChoice" - - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerNumber" + - $ref: "#/components/schemas/ResultBodyBaseAnswerCountsPerInteger" description: | 選択肢ごとの回答数の配列 - ResultSettingsMultipleChoice: + ResultBodyMultipleChoice: allOf: - $ref: "#/components/schemas/QuestionTypeMultipleChoice" - - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerNumber" + - $ref: "#/components/schemas/ResultBodyBaseAnswerCountsPerInteger" description: | 選択肢ごとの回答数の配列 - ResultSettingsScale: + ResultBodyScale: allOf: - $ref: "#/components/schemas/QuestionTypeScale" - - $ref: "#/components/schemas/ResultSettingsAnswerCountsPerNumber" + - $ref: "#/components/schemas/ResultBodyBaseAnswerCountsPerInteger" description: | 数値ごとの回答数の配列 - ResultSettingsAnswerCountsPerString: + ResultBodyBaseAnswerCountsPerString: type: object properties: - answer_counts_per_string: + answer_counts_per_answer: type: array items: type: object @@ -1021,16 +1027,16 @@ components: answer: type: string answer_count: - type: number + type: integer required: - answer - answer_count required: - - answer_counts_per_string - ResultSettingsAnswerCountsPerNumber: + - answer_counts_per_answer + ResultBodyBaseAnswerCountsPerNumber: type: object properties: - answer_counts_per_number: + answer_counts_per_answer: type: array items: type: object @@ -1038,12 +1044,29 @@ components: answer: type: number answer_count: - type: number + type: integer required: - answer - answer_count required: - - answer_counts_per_number + - answer_counts_per_answer + ResultBodyBaseAnswerCountsPerInteger: + type: object + properties: + answer_counts_per_answer: + type: array + items: + type: object + properties: + answer: + type: integer + answer_count: + type: integer + required: + - answer + - answer_count + required: + - answer_counts_per_answer UsersAndGroups: type: object properties: @@ -1057,10 +1080,12 @@ components: Users: type: array items: - type: string - example: cp20 - description: | - traQ ID + $ref: "#/components/schemas/TraqId" + TraqId: + type: string + example: cp20 + description: | + traQ ID Groups: type: array items: From 9cea278a7f406411121b4b443446b20aeb2de556 Mon Sep 17 00:00:00 2001 From: rei Date: Sat, 16 Dec 2023 12:37:19 +0900 Subject: [PATCH 51/77] =?UTF-8?q?[chore]=20swagger.yaml=E3=81=AE=E6=94=B9?= =?UTF-8?q?=E4=BF=AE=20is=5Fanswer=5Frequired=E3=82=92is=5Frequired=20?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4=20respondent=E3=82=92Response?= =?UTF-8?q?=E3=81=AB=E7=A7=BB=E5=8B=95=20aggregated=5Fanswers=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 44 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index cf9a64a9..d869e25e 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -710,7 +710,7 @@ components: type: string description: type: string - is_answer_required: + is_required: type: boolean description: | 回答必須かどうか @@ -718,7 +718,7 @@ components: - questionnaire_id - title - description - - is_answer_required + - is_required QuestionSettingsByType: oneOf: - $ref: "#/components/schemas/QuestionSettingsText" @@ -839,8 +839,6 @@ components: NewResponse: type: object properties: - respondent: - $ref: "#/components/schemas/TraqId" is_draft: type: boolean example: true @@ -849,7 +847,6 @@ components: items: $ref: "#/components/schemas/ResponseBody" required: - - respondent - is_draft - body Response: @@ -860,6 +857,8 @@ components: response_id: type: integer example: 1 + respondent: + $ref: "#/components/schemas/TraqId" submitted_at: type: string format: date-time @@ -870,6 +869,7 @@ components: example: 2020-01-01T00:00:00+09:00 required: - response_id + - respondent - submitted_at - modified_at - $ref: "#/components/schemas/NewResponse" @@ -922,14 +922,14 @@ components: - $ref: "#/components/schemas/QuestionTypeMultipleChoice" - type: object properties: - answers: + answer: type: array items: type: integer description: | 選択肢のインデックスの配列 required: - - answers + - answer ResponseBodyScale: allOf: - $ref: "#/components/schemas/QuestionTypeScale" @@ -983,43 +983,43 @@ components: ResultBodyText: allOf: - $ref: "#/components/schemas/QuestionTypeText" - - $ref: "#/components/schemas/ResultBodyBaseAnswerCountsPerString" + - $ref: "#/components/schemas/ResultBodyBaseStringAnswer" description: | 回答文ごとの回答数の配列 ResultBodyTextLong: allOf: - $ref: "#/components/schemas/QuestionTypeTextLong" - - $ref: "#/components/schemas/ResultBodyBaseAnswerCountsPerString" + - $ref: "#/components/schemas/ResultBodyBaseStringAnswer" description: | 回答文ごとの回答数の配列 ResultBodyNumber: allOf: - $ref: "#/components/schemas/QuestionTypeNumber" - - $ref: "#/components/schemas/ResultBodyBaseAnswerCountsPerNumber" + - $ref: "#/components/schemas/ResultBodyBaseNumberAnswer" description: | 数値ごとの回答数の配列 ResultBodySingleChoice: allOf: - $ref: "#/components/schemas/QuestionTypeSingleChoice" - - $ref: "#/components/schemas/ResultBodyBaseAnswerCountsPerInteger" + - $ref: "#/components/schemas/ResultBodyBaseIntegerAnswer" description: | 選択肢ごとの回答数の配列 ResultBodyMultipleChoice: allOf: - $ref: "#/components/schemas/QuestionTypeMultipleChoice" - - $ref: "#/components/schemas/ResultBodyBaseAnswerCountsPerInteger" + - $ref: "#/components/schemas/ResultBodyBaseIntegerAnswer" description: | 選択肢ごとの回答数の配列 ResultBodyScale: allOf: - $ref: "#/components/schemas/QuestionTypeScale" - - $ref: "#/components/schemas/ResultBodyBaseAnswerCountsPerInteger" + - $ref: "#/components/schemas/ResultBodyBaseIntegerAnswer" description: | 数値ごとの回答数の配列 - ResultBodyBaseAnswerCountsPerString: + ResultBodyBaseStringAnswer: type: object properties: - answer_counts_per_answer: + aggregated_answers: type: array items: type: object @@ -1032,11 +1032,11 @@ components: - answer - answer_count required: - - answer_counts_per_answer - ResultBodyBaseAnswerCountsPerNumber: + - aggregated_answers + ResultBodyBaseNumberAnswer: type: object properties: - answer_counts_per_answer: + aggregated_answers: type: array items: type: object @@ -1049,11 +1049,11 @@ components: - answer - answer_count required: - - answer_counts_per_answer - ResultBodyBaseAnswerCountsPerInteger: + - aggregated_answers + ResultBodyBaseIntegerAnswer: type: object properties: - answer_counts_per_answer: + aggregated_answers: type: array items: type: object @@ -1066,7 +1066,7 @@ components: - answer - answer_count required: - - answer_counts_per_answer + - aggregated_answers UsersAndGroups: type: object properties: From 879f2ff0a92bfd38b3b4fe1974f3b1f03e3c74fa Mon Sep 17 00:00:00 2001 From: kaitoyama Date: Sat, 16 Dec 2023 18:07:04 +0900 Subject: [PATCH 52/77] change migrations() --- model/current.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/model/current.go b/model/current.go index daf90934..9b3fea3e 100644 --- a/model/current.go +++ b/model/current.go @@ -6,9 +6,7 @@ import ( // Migrations is all db migrations func Migrations() []*gormigrate.Migration { - return []*gormigrate.Migration{ - {}, - } + return []*gormigrate.Migration{} } func AllTables() []interface{} { From 5d81be985de036115d4450c80cc235146d11904a Mon Sep 17 00:00:00 2001 From: kaitoyama Date: Sun, 17 Dec 2023 01:17:05 +0900 Subject: [PATCH 53/77] add gorm session --- model/db.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/db.go b/model/db.go index 43a749a4..04281c32 100755 --- a/model/db.go +++ b/model/db.go @@ -72,7 +72,7 @@ func EstablishConnection(isProduction bool) error { } func Migrate() (init bool, err error) { - m := gormigrate.New(db, gormigrate.DefaultOptions, Migrations()) + m := gormigrate.New(db.Session(&gorm.Session{}), gormigrate.DefaultOptions, Migrations()) m.InitSchema(func(db *gorm.DB) error { init = true From ec7b97d3b416f69105be94b73926fb6ca479ac21 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 17 Dec 2023 13:08:58 +0900 Subject: [PATCH 54/77] =?UTF-8?q?[chore]=20swagger.yaml=20result=E3=82=92?= =?UTF-8?q?=E5=8C=BF=E5=90=8D=E5=9B=9E=E7=AD=94=E3=81=AE=E9=85=8D=E5=88=97?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 128 ++++++-------------------------------- 1 file changed, 20 insertions(+), 108 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index d869e25e..9753f0dc 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -956,117 +956,29 @@ components: required: - answer Result: - type: object - properties: - questionnaire_id: - type: integer - example: 1 - response_count: - type: integer - example: 1 - body: - type: array - items: - $ref: "#/components/schemas/ResultBody" - required: - - questionnaire_id - - response_count - - body - ResultBody: - oneOf: - - $ref: "#/components/schemas/ResultBodyText" - - $ref: "#/components/schemas/ResultBodyTextLong" - - $ref: "#/components/schemas/ResultBodyNumber" - - $ref: "#/components/schemas/ResultBodySingleChoice" - - $ref: "#/components/schemas/ResultBodyMultipleChoice" - - $ref: "#/components/schemas/ResultBodyScale" - ResultBodyText: - allOf: - - $ref: "#/components/schemas/QuestionTypeText" - - $ref: "#/components/schemas/ResultBodyBaseStringAnswer" - description: | - 回答文ごとの回答数の配列 - ResultBodyTextLong: - allOf: - - $ref: "#/components/schemas/QuestionTypeTextLong" - - $ref: "#/components/schemas/ResultBodyBaseStringAnswer" - description: | - 回答文ごとの回答数の配列 - ResultBodyNumber: - allOf: - - $ref: "#/components/schemas/QuestionTypeNumber" - - $ref: "#/components/schemas/ResultBodyBaseNumberAnswer" - description: | - 数値ごとの回答数の配列 - ResultBodySingleChoice: - allOf: - - $ref: "#/components/schemas/QuestionTypeSingleChoice" - - $ref: "#/components/schemas/ResultBodyBaseIntegerAnswer" - description: | - 選択肢ごとの回答数の配列 - ResultBodyMultipleChoice: - allOf: - - $ref: "#/components/schemas/QuestionTypeMultipleChoice" - - $ref: "#/components/schemas/ResultBodyBaseIntegerAnswer" - description: | - 選択肢ごとの回答数の配列 - ResultBodyScale: - allOf: - - $ref: "#/components/schemas/QuestionTypeScale" - - $ref: "#/components/schemas/ResultBodyBaseIntegerAnswer" - description: | - 数値ごとの回答数の配列 - ResultBodyBaseStringAnswer: - type: object - properties: - aggregated_answers: - type: array - items: - type: object - properties: - answer: - type: string - answer_count: - type: integer - required: - - answer - - answer_count - required: - - aggregated_answers - ResultBodyBaseNumberAnswer: - type: object - properties: - aggregated_answers: - type: array - items: - type: object - properties: - answer: - type: number - answer_count: - type: integer - required: - - answer - - answer_count - required: - - aggregated_answers - ResultBodyBaseIntegerAnswer: - type: object - properties: - aggregated_answers: - type: array - items: - type: object + type: array + items: + allOf: + - $ref: "#/components/schemas/QuestionnaireID" + - type: object properties: - answer: - type: integer - answer_count: + 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: - - answer - - answer_count - required: - - aggregated_answers + - response_id + - respondent + - submitted_at + - modified_at + - $ref: "#/components/schemas/NewResponse" UsersAndGroups: type: object properties: From cf2b053442970bff179e11a55761043d51c06c32 Mon Sep 17 00:00:00 2001 From: cp-20 <47262658+mario-hsp@users.noreply.github.com> Date: Sun, 17 Dec 2023 14:57:04 +0900 Subject: [PATCH 55/77] =?UTF-8?q?fix:=20`responded=5Fdate=5Ftime=5Fby=5Fme?= =?UTF-8?q?`=E3=82=92optional=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 9753f0dc..beade87d 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -528,7 +528,6 @@ components: required: - has_my_draft - has_my_response - - responded_date_time_by_me - all_responded QuestionnaireList: type: object From 4eebd3123ab7b517529dd65cb6d3ee4316d5b609 Mon Sep 17 00:00:00 2001 From: rei Date: Wed, 20 Dec 2023 10:11:29 +0900 Subject: [PATCH 56/77] =?UTF-8?q?[chore]=20swagger.yaml=E3=81=AE=E6=94=B9?= =?UTF-8?q?=E4=BF=AE=20QuestionnaireDetail=E3=81=ABRespondent=5Fcount?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97=E3=80=81respondents?= =?UTF-8?q?=E3=82=92optional=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 9753f0dc..24cb2f0a 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -494,9 +494,14 @@ components: allOf: - $ref: "#/components/schemas/QuestionnaireID" - $ref: "#/components/schemas/NewQuestionnaire" - - $ref: "#/components/schemas/QuestionnaireRespondents" - $ref: "#/components/schemas/QuestionnaireCreatedAt" - $ref: "#/components/schemas/QuestionnaireModifiedAt" + - $ref: "#/components/schemas/QuestionnaireRespondentCount" + - properties: + respondents: + $ref: "#/components/schemas/Users" + description: | + 回答者の一覧。匿名回答の場合はnull。 QuestionnaireSummary: allOf: - $ref: "#/components/schemas/QuestionnaireID" @@ -643,6 +648,13 @@ components: example: 2020-01-01T00:00:00+09:00 required: - modified_at + QuestionnaireRespondentCount: + type: object + properties: + respondent_count: + type: integer + required: + - respondent_count QuestionnaireTargetsAndAdmins: type: object properties: @@ -653,13 +665,6 @@ components: required: - targets - admins - QuestionnaireRespondents: - type: object - properties: - respondents: - $ref: "#/components/schemas/Users" - required: - - respondents QuestionnaireHasMyResponse: type: object properties: From a432702a4d289abcc0b92151ec712d52330e1d15 Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 16 Jan 2024 15:14:28 +0900 Subject: [PATCH 57/77] =?UTF-8?q?[chore]=20swagger.yaml=20QuestionnaireSum?= =?UTF-8?q?mary=E3=81=ABmy=5Fresponses=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 41 +++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 24cb2f0a..5a7ab4d4 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -516,24 +516,19 @@ components: - $ref: "#/components/schemas/QuestionnaireCreatedAt" - $ref: "#/components/schemas/QuestionnaireModifiedAt" - properties: - has_my_draft: - type: boolean - description: 下書きが存在する - has_my_response: - type: boolean - description: 回答が存在する - responded_date_time_by_me: - type: string - format: date-time + my_responses: + type: array + items: + $ref: "#/components/schemas/MyResponses" + description: | + 自分の回答の一覧。下書きを含む。 all_responded: type: boolean example: true description: | すべての対象者が回答済みの場合 true を返す。それ以外は false を返す。 (対象者が存在しない場合は true を返す) required: - - has_my_draft - - has_my_response - - responded_date_time_by_me + - my_responses - all_responded QuestionnaireList: type: object @@ -882,6 +877,28 @@ components: type: array items: $ref: "#/components/schemas/Response" + MyResponses: + type: object + properties: + response_id: + type: integer + example: 1 + is_draft: + type: boolean + example: true + 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 + - is_draft + - submitted_at + - modified_at ResponsesWithQuestionnaireInfo: type: array items: From 3d3927cf63532d66ecb09abb3c59bea1427ceae4 Mon Sep 17 00:00:00 2001 From: rei Date: Tue, 16 Jan 2024 21:49:35 +0900 Subject: [PATCH 58/77] =?UTF-8?q?[chore]=20swagger.yaml=20schema=E3=81=AE?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E3=82=92MyResponses=E3=81=8B=E3=82=89Questio?= =?UTF-8?q?nnaireMyResponse=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 46 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 5a7ab4d4..a8c5e635 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -519,7 +519,7 @@ components: my_responses: type: array items: - $ref: "#/components/schemas/MyResponses" + $ref: "#/components/schemas/QuestionnaireMyResponse" description: | 自分の回答の一覧。下書きを含む。 all_responded: @@ -677,6 +677,28 @@ components: 自分に対するリマインドが有効かどうか。ユーザーが対象者でありかつ回答していない場合、この値がtrueであればリマインドが送信される。 required: - is_remind_enabled + QuestionnaireMyResponse: + type: object + properties: + response_id: + type: integer + example: 1 + is_draft: + type: boolean + example: true + 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 + - is_draft + - submitted_at + - modified_at NewQuestion: allOf: - $ref: "#/components/schemas/QuestionBase" @@ -877,28 +899,6 @@ components: type: array items: $ref: "#/components/schemas/Response" - MyResponses: - type: object - properties: - response_id: - type: integer - example: 1 - is_draft: - type: boolean - example: true - 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 - - is_draft - - submitted_at - - modified_at ResponsesWithQuestionnaireInfo: type: array items: From 57e98b8efb6c4203b88da485149f9b585886a17d Mon Sep 17 00:00:00 2001 From: rei Date: Thu, 18 Jan 2024 15:53:30 +0900 Subject: [PATCH 59/77] =?UTF-8?q?QuestionnaireSummary=E3=81=8B=E3=82=89my?= =?UTF-8?q?=5Fresponses=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 41 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index a8c5e635..24cb2f0a 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -516,19 +516,24 @@ components: - $ref: "#/components/schemas/QuestionnaireCreatedAt" - $ref: "#/components/schemas/QuestionnaireModifiedAt" - properties: - my_responses: - type: array - items: - $ref: "#/components/schemas/QuestionnaireMyResponse" - description: | - 自分の回答の一覧。下書きを含む。 + has_my_draft: + type: boolean + description: 下書きが存在する + has_my_response: + type: boolean + description: 回答が存在する + responded_date_time_by_me: + type: string + format: date-time all_responded: type: boolean example: true description: | すべての対象者が回答済みの場合 true を返す。それ以外は false を返す。 (対象者が存在しない場合は true を返す) required: - - my_responses + - has_my_draft + - has_my_response + - responded_date_time_by_me - all_responded QuestionnaireList: type: object @@ -677,28 +682,6 @@ components: 自分に対するリマインドが有効かどうか。ユーザーが対象者でありかつ回答していない場合、この値がtrueであればリマインドが送信される。 required: - is_remind_enabled - QuestionnaireMyResponse: - type: object - properties: - response_id: - type: integer - example: 1 - is_draft: - type: boolean - example: true - 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 - - is_draft - - submitted_at - - modified_at NewQuestion: allOf: - $ref: "#/components/schemas/QuestionBase" From 8906871aa51e47f33bffdaa163d3086890654c50 Mon Sep 17 00:00:00 2001 From: rei Date: Thu, 18 Jan 2024 16:09:24 +0900 Subject: [PATCH 60/77] =?UTF-8?q?QuestionnaireDetail=E3=81=8B=E3=82=89Resp?= =?UTF-8?q?ondentCount=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 24cb2f0a..f370e654 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -496,13 +496,12 @@ components: - $ref: "#/components/schemas/NewQuestionnaire" - $ref: "#/components/schemas/QuestionnaireCreatedAt" - $ref: "#/components/schemas/QuestionnaireModifiedAt" - - $ref: "#/components/schemas/QuestionnaireRespondentCount" - properties: respondents: $ref: "#/components/schemas/Users" description: | 回答者の一覧。匿名回答の場合はnull。 - QuestionnaireSummary: + QuestionnaireSummary: # ResponseCountとRespondentCountを入れてもいいかも allOf: - $ref: "#/components/schemas/QuestionnaireID" - $ref: "#/components/schemas/QuestionnaireTitle" @@ -648,13 +647,6 @@ components: example: 2020-01-01T00:00:00+09:00 required: - modified_at - QuestionnaireRespondentCount: - type: object - properties: - respondent_count: - type: integer - required: - - respondent_count QuestionnaireTargetsAndAdmins: type: object properties: From a69c8b4cbd11a74440d61d3f550b529a97bdf0df Mon Sep 17 00:00:00 2001 From: cp-20 <47262658+mario-hsp@users.noreply.github.com> Date: Mon, 22 Jan 2024 18:36:48 +0900 Subject: [PATCH 61/77] fix: router test --- router/questionnaires_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router/questionnaires_test.go b/router/questionnaires_test.go index 5db7416f..8e934895 100644 --- a/router/questionnaires_test.go +++ b/router/questionnaires_test.go @@ -1143,7 +1143,7 @@ func TestPostQuestionByQuestionnaireID(t *testing.T) { buf := bytes.NewBuffer(nil) err := json.NewEncoder(buf).Encode(test.request) if err != nil { - t.Errorf("failed to encode request: %w", err) + t.Errorf("failed to encode request: %v", err) } request = buf From 0acb96616bfeb16d0f232faa017f0c9b281d4beb Mon Sep 17 00:00:00 2001 From: cp-20 <47262658+mario-hsp@users.noreply.github.com> Date: Mon, 22 Jan 2024 18:54:34 +0900 Subject: [PATCH 62/77] wip: add debug print --- model/questions_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/model/questions_test.go b/model/questions_test.go index 71880ee8..13c1a5f6 100644 --- a/model/questions_test.go +++ b/model/questions_test.go @@ -3,6 +3,7 @@ package model import ( "context" "errors" + "fmt" "sort" "testing" "time" @@ -892,6 +893,7 @@ func getQuestionsTest(t *testing.T) { assertion.Subset(actualQuestionIDs, expectQuestionIDs, testCase.description, "elements") + fmt.Printf("%+v\n", questions) assertion.True(sort.SliceIsSorted(questions, func(i, j int) bool { return questions[i].QuestionNum <= questions[j].QuestionNum }), testCase.description, "sort") expectQuestionMap := make(map[int]*Questions, len(expectQuestions)) From 65b0a2028d617a893f52074d125f2bc0a6aff010 Mon Sep 17 00:00:00 2001 From: cp-20 <47262658+mario-hsp@users.noreply.github.com> Date: Mon, 22 Jan 2024 19:25:03 +0900 Subject: [PATCH 63/77] =?UTF-8?q?fix:=20Flaky=E3=81=AA=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=82=92=E5=BC=95=E3=81=8D=E8=B5=B7=E3=81=93=E3=81=99?= =?UTF-8?q?=E3=80=81=E6=80=AA=E3=81=97=E3=81=84=E3=83=86=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=82=B1=E3=83=BC=E3=82=B9=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/questions_test.go | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/model/questions_test.go b/model/questions_test.go index 13c1a5f6..e175a939 100644 --- a/model/questions_test.go +++ b/model/questions_test.go @@ -504,29 +504,6 @@ func updateQuestionTest(t *testing.T) { }, }, }, - { - description: "questionnaireID: valid->valid", - before: before{ - Questions: Questions{ - QuestionnaireID: questionnaireDatas[0].ID, - PageNum: 1, - QuestionNum: 1, - Type: "TextArea", - Body: "自由記述欄", - IsRequired: false, - }, - }, - after: after{ - Questions: Questions{ - QuestionnaireID: questionnaireDatas[1].ID, - PageNum: 1, - QuestionNum: 1, - Type: "TextArea", - Body: "自由記述欄", - IsRequired: false, - }, - }, - }, { description: "questionnaireID: valid->invalid", before: before{ From a332eef3e089fd973c8c67dea9eb982e4c4b9544 Mon Sep 17 00:00:00 2001 From: cp-20 <47262658+mario-hsp@users.noreply.github.com> Date: Mon, 22 Jan 2024 19:25:42 +0900 Subject: [PATCH 64/77] wip: remove debug log --- model/questions_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/model/questions_test.go b/model/questions_test.go index e175a939..5e0392bc 100644 --- a/model/questions_test.go +++ b/model/questions_test.go @@ -3,7 +3,6 @@ package model import ( "context" "errors" - "fmt" "sort" "testing" "time" @@ -870,7 +869,6 @@ func getQuestionsTest(t *testing.T) { assertion.Subset(actualQuestionIDs, expectQuestionIDs, testCase.description, "elements") - fmt.Printf("%+v\n", questions) assertion.True(sort.SliceIsSorted(questions, func(i, j int) bool { return questions[i].QuestionNum <= questions[j].QuestionNum }), testCase.description, "sort") expectQuestionMap := make(map[int]*Questions, len(expectQuestions)) From 0ef767c41ca5c889411f27c04bb21edbdbb5e547 Mon Sep 17 00:00:00 2001 From: cp-20 <47262658+mario-hsp@users.noreply.github.com> Date: Tue, 23 Jan 2024 15:38:01 +0900 Subject: [PATCH 65/77] wip: add debug print --- model/questionnaires_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/model/questionnaires_test.go b/model/questionnaires_test.go index d8a3b3d8..23cc2296 100644 --- a/model/questionnaires_test.go +++ b/model/questionnaires_test.go @@ -3,6 +3,7 @@ package model import ( "context" "errors" + "fmt" "math" "sort" "strings" @@ -1096,6 +1097,10 @@ func getQuestionnairesTest(t *testing.T) { } if len(testCase.args.search) == 0 && !testCase.args.nontargeted { + fmt.Println(testCase.description) + fmt.Println(questionnaireNum) + fmt.Println(pageMax) + fmt.Printf("%+v\n", questionnaires) assertion.Equal((questionnaireNum+19)/20, int64(pageMax), testCase.description, "pageMax") assertion.Len(questionnaires, int(math.Min(float64(questionnaireNum-20*(int64(testCase.pageNum)-1)), 20.0)), testCase.description, "page") } From 05d7933f01b5c196cf65df0206b592f69256ddeb Mon Sep 17 00:00:00 2001 From: cp-20 <47262658+mario-hsp@users.noreply.github.com> Date: Tue, 23 Jan 2024 18:55:57 +0900 Subject: [PATCH 66/77] wip: add debug print --- model/questionnaires_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/model/questionnaires_test.go b/model/questionnaires_test.go index 23cc2296..817acd93 100644 --- a/model/questionnaires_test.go +++ b/model/questionnaires_test.go @@ -1100,7 +1100,12 @@ func getQuestionnairesTest(t *testing.T) { fmt.Println(testCase.description) fmt.Println(questionnaireNum) fmt.Println(pageMax) - fmt.Printf("%+v\n", questionnaires) + var allNum int64 + db. + Session(&gorm.Session{NewDB: true}). + Model(&Questionnaires{}). + Count(&allNum) + fmt.Println(allNum) assertion.Equal((questionnaireNum+19)/20, int64(pageMax), testCase.description, "pageMax") assertion.Len(questionnaires, int(math.Min(float64(questionnaireNum-20*(int64(testCase.pageNum)-1)), 20.0)), testCase.description, "page") } From f40e63053327943b76258a8b384becb84a37b899 Mon Sep 17 00:00:00 2001 From: cp-20 <47262658+mario-hsp@users.noreply.github.com> Date: Tue, 23 Jan 2024 23:23:35 +0900 Subject: [PATCH 67/77] =?UTF-8?q?questionnaires=5Fimpl=E3=82=92=E7=9B=B4?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/questionnaires_impl.go | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/model/questionnaires_impl.go b/model/questionnaires_impl.go index 5aefbb78..e7756bc7 100755 --- a/model/questionnaires_impl.go +++ b/model/questionnaires_impl.go @@ -19,7 +19,7 @@ func NewQuestionnaire() *Questionnaire { return new(Questionnaire) } -//Questionnaires questionnairesテーブルの構造体 +// Questionnaires questionnairesテーブルの構造体 type Questionnaires struct { ID int `json:"questionnaireID" gorm:"type:int(11) AUTO_INCREMENT;not null;primaryKey"` Title string `json:"title" gorm:"type:char(50);size:50;not null"` @@ -44,20 +44,20 @@ func (questionnaire *Questionnaires) BeforeCreate(tx *gorm.DB) error { return nil } -//BeforeUpdate Update時に自動でmodified_atを現在時刻に +// BeforeUpdate Update時に自動でmodified_atを現在時刻に func (questionnaire *Questionnaires) BeforeUpdate(tx *gorm.DB) error { questionnaire.ModifiedAt = time.Now() return nil } -//QuestionnaireInfo Questionnaireにtargetかの情報追加 +// QuestionnaireInfo Questionnaireにtargetかの情報追加 type QuestionnaireInfo struct { Questionnaires IsTargeted bool `json:"is_targeted" gorm:"type:boolean"` } -//QuestionnaireDetail Questionnaireの詳細 +// QuestionnaireDetail Questionnaireの詳細 type QuestionnaireDetail struct { Targets []string Respondents []string @@ -65,7 +65,7 @@ type QuestionnaireDetail struct { Questionnaires } -//TargettedQuestionnaire targetになっているアンケートの情報 +// TargettedQuestionnaire targetになっているアンケートの情報 type TargettedQuestionnaire struct { Questionnaires RespondedAt null.Time `json:"responded_at"` @@ -78,7 +78,7 @@ type ResponseReadPrivilegeInfo struct { IsRespondent bool } -//InsertQuestionnaire アンケートの追加 +// InsertQuestionnaire アンケートの追加 func (*Questionnaire) InsertQuestionnaire(ctx context.Context, title string, description string, resTimeLimit null.Time, resSharedTo string) (int, error) { db, err := getTx(ctx) if err != nil { @@ -109,7 +109,7 @@ func (*Questionnaire) InsertQuestionnaire(ctx context.Context, title string, des return questionnaire.ID, nil } -//UpdateQuestionnaire アンケートの更新 +// UpdateQuestionnaire アンケートの更新 func (*Questionnaire) UpdateQuestionnaire(ctx context.Context, title string, description string, resTimeLimit null.Time, resSharedTo string, questionnaireID int) error { db, err := getTx(ctx) if err != nil { @@ -148,7 +148,7 @@ func (*Questionnaire) UpdateQuestionnaire(ctx context.Context, title string, des return nil } -//DeleteQuestionnaire アンケートの削除 +// DeleteQuestionnaire アンケートの削除 func (*Questionnaire) DeleteQuestionnaire(ctx context.Context, questionnaireID int) error { db, err := getTx(ctx) if err != nil { @@ -167,8 +167,10 @@ func (*Questionnaire) DeleteQuestionnaire(ctx context.Context, questionnaireID i return nil } -/*GetQuestionnaires アンケートの一覧 -2つ目の戻り値はページ数の最大値*/ +/* +GetQuestionnaires アンケートの一覧 +2つ目の戻り値はページ数の最大値 +*/ func (*Questionnaire) GetQuestionnaires(ctx context.Context, userID string, sort string, search string, pageNum int, nontargeted bool) ([]QuestionnaireInfo, int, error) { ctx, cancel := context.WithTimeout(ctx, 3*time.Second) defer cancel() @@ -182,6 +184,7 @@ func (*Questionnaire) GetQuestionnaires(ctx context.Context, userID string, sort query := db. Table("questionnaires"). + Where("deleted_at IS NULL"). Joins("LEFT OUTER JOIN targets ON questionnaires.id = targets.questionnaire_id") query, err = setQuestionnairesOrder(query, sort) @@ -263,7 +266,7 @@ func (*Questionnaire) GetAdminQuestionnaires(ctx context.Context, userID string) return questionnaires, nil } -//GetQuestionnaireInfo アンケートの詳細な情報取得 +// GetQuestionnaireInfo アンケートの詳細な情報取得 func (*Questionnaire) GetQuestionnaireInfo(ctx context.Context, questionnaireID int) (*Questionnaires, []string, []string, []string, error) { db, err := getTx(ctx) if err != nil { @@ -315,7 +318,7 @@ func (*Questionnaire) GetQuestionnaireInfo(ctx context.Context, questionnaireID return &questionnaire, targets, administrators, respondents, nil } -//GetTargettedQuestionnaires targetになっているアンケートの取得 +// GetTargettedQuestionnaires targetになっているアンケートの取得 func (*Questionnaire) GetTargettedQuestionnaires(ctx context.Context, userID string, answered string, sort string) ([]TargettedQuestionnaire, error) { db, err := getTx(ctx) if err != nil { @@ -359,7 +362,7 @@ func (*Questionnaire) GetTargettedQuestionnaires(ctx context.Context, userID str return questionnaires, nil } -//GetQuestionnaireLimit アンケートの回答期限の取得 +// GetQuestionnaireLimit アンケートの回答期限の取得 func (*Questionnaire) GetQuestionnaireLimit(ctx context.Context, questionnaireID int) (null.Time, error) { db, err := getTx(ctx) if err != nil { From 4fada295a65dbfbf04f6babb51603050e63ac8ca Mon Sep 17 00:00:00 2001 From: cp-20 <47262658+mario-hsp@users.noreply.github.com> Date: Wed, 24 Jan 2024 05:02:43 +0900 Subject: [PATCH 68/77] fix: questionnaire_test --- model/questionnaires_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/model/questionnaires_test.go b/model/questionnaires_test.go index 817acd93..16b80506 100644 --- a/model/questionnaires_test.go +++ b/model/questionnaires_test.go @@ -347,7 +347,6 @@ func setupQuestionnairesTest(t *testing.T) { func insertQuestionnaireTest(t *testing.T) { t.Helper() - t.Parallel() assertion := assert.New(t) @@ -484,7 +483,6 @@ func insertQuestionnaireTest(t *testing.T) { func updateQuestionnaireTest(t *testing.T) { t.Helper() - t.Parallel() assertion := assert.New(t) @@ -741,7 +739,6 @@ func updateQuestionnaireTest(t *testing.T) { func deleteQuestionnaireTest(t *testing.T) { t.Helper() - t.Parallel() assertion := assert.New(t) From b18969818c5c09d874ef701dad3e27a97b3fe874 Mon Sep 17 00:00:00 2001 From: rei Date: Fri, 8 Mar 2024 02:20:40 +0900 Subject: [PATCH 69/77] =?UTF-8?q?[chore]=20swagger.yaml=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20QuestionnaireDetail=E3=81=AEquestions=E3=82=92NewQu?= =?UTF-8?q?estions=E3=81=8B=E3=82=89Questions=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger/swagger.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index f370e654..43fbd046 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -473,7 +473,7 @@ components: description: | アンケートの結果を, 運営は見られる ("admins"), 回答済みの人は見られる ("respondents") 誰でも見られる ("anyone") - NewQuestionnaire: + QuestionnaireBase: allOf: - $ref: "#/components/schemas/QuestionnaireTitle" - $ref: "#/components/schemas/QuestionnaireDescription" @@ -483,6 +483,9 @@ components: - $ref: "#/components/schemas/QuestionnaireIsAllowingMultipleResponses" - $ref: "#/components/schemas/QuestionnaireIsPublished" - $ref: "#/components/schemas/QuestionnaireTargetsAndAdmins" + NewQuestionnaire: + allOf: + - $ref: "#/components/schemas/QuestionnaireBase" - properties: questions: type: array @@ -493,14 +496,21 @@ components: QuestionnaireDetail: allOf: - $ref: "#/components/schemas/QuestionnaireID" - - $ref: "#/components/schemas/NewQuestionnaire" + - $ref: "#/components/schemas/QuestionnaireBase" - $ref: "#/components/schemas/QuestionnaireCreatedAt" - $ref: "#/components/schemas/QuestionnaireModifiedAt" - properties: + questions: + type: array + items: + $ref: "#/components/schemas/Question" respondents: $ref: "#/components/schemas/Users" description: | 回答者の一覧。匿名回答の場合はnull。 + required: + - questions + - respondents QuestionnaireSummary: # ResponseCountとRespondentCountを入れてもいいかも allOf: - $ref: "#/components/schemas/QuestionnaireID" @@ -693,10 +703,6 @@ components: required: - question_id - created_at - Questions: - type: array - items: - $ref: "#/components/schemas/Question" QuestionBase: type: object properties: From aad52717a9057fa261d7df0749f65467b5001fb0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:43:52 +0000 Subject: [PATCH 70/77] Bump golang from 1.20.7-alpine to 1.22.2-alpine in /docker/tuning Bumps golang from 1.20.7-alpine to 1.22.2-alpine. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- docker/tuning/Dockerfile.server | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/tuning/Dockerfile.server b/docker/tuning/Dockerfile.server index 38e5f11e..eed7c56e 100644 --- a/docker/tuning/Dockerfile.server +++ b/docker/tuning/Dockerfile.server @@ -1,4 +1,4 @@ -FROM golang:1.20.7-alpine as build-step +FROM golang:1.22.2-alpine as build-step RUN apk add --update --no-cache ca-certificates git WORKDIR /go/src/github.com/traPtitech/anke-to From f5bebd3c75a1425b40df40ffb9c06422d2a7ff42 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:43:57 +0000 Subject: [PATCH 71/77] Bump golang from 1.20.7-alpine to 1.22.2-alpine Bumps golang from 1.20.7-alpine to 1.22.2-alpine. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 82a44dec..7f125e40 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax = docker/dockerfile:1.3.0 # build backend -FROM golang:1.20.7-alpine as server-build +FROM golang:1.22.2-alpine as server-build RUN --mount=type=cache,target=/var/cache/apk \ apk add --update git From ab1014d8ec50843a9d3eb8ef8ead167acee0c0c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:53:02 +0000 Subject: [PATCH 72/77] Bump golang from 1.20.7-alpine to 1.22.2-alpine in /docker/staging Bumps golang from 1.20.7-alpine to 1.22.2-alpine. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- docker/staging/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/staging/Dockerfile b/docker/staging/Dockerfile index 2478edd7..4743501d 100644 --- a/docker/staging/Dockerfile +++ b/docker/staging/Dockerfile @@ -1,7 +1,7 @@ # syntax = docker/dockerfile:1.3.0 # build backend -FROM golang:1.20.7-alpine as server-build +FROM golang:1.22.2-alpine as server-build RUN --mount=type=cache,target=/var/cache/apk \ apk add --update git From 5f3efb6a09bbd7f6dc0edfa524481b21dc023f88 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:57:49 +0000 Subject: [PATCH 73/77] Bump golang from 1.20.7-alpine to 1.22.2-alpine in /docker/dev Bumps golang from 1.20.7-alpine to 1.22.2-alpine. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- docker/dev/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index 24f74ca2..7e452281 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20.7-alpine as build-step +FROM golang:1.22.2-alpine as build-step RUN apk add --update --no-cache ca-certificates git WORKDIR /go/src/github.com/traPtitech/anke-to From cf48bb06cf9ca06203eb9b7c02b0f0c236139386 Mon Sep 17 00:00:00 2001 From: kaitoyama <45167401+kaitoyama@users.noreply.github.com> Date: Sat, 27 Apr 2024 13:21:41 +0900 Subject: [PATCH 74/77] upgrade golang version --- docker/test/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/test/Dockerfile b/docker/test/Dockerfile index 71351a61..92a5ef39 100644 --- a/docker/test/Dockerfile +++ b/docker/test/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20.7-alpine as builder +FROM golang:1.22.2-alpine as builder RUN apk add --update --no-cache ca-certificates git \ && apk add --no-cache gcc libc-dev \ && apk add --no-cache openssl From a48e20ac1faf9aa9cee89f1c8d6e4c75344c083c Mon Sep 17 00:00:00 2001 From: ErrorSyntax1 Date: Mon, 1 Jul 2024 11:59:16 +0900 Subject: [PATCH 75/77] =?UTF-8?q?fix:EditResponse=E3=81=A7=E6=9C=80?= =?UTF-8?q?=E5=BE=8C=E3=81=AE=E8=B3=AA=E5=95=8F=E3=81=AE=E7=AF=84=E5=9B=B2?= =?UTF-8?q?=E3=81=8C=E9=81=A9=E7=94=A8=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=81=9F=E3=81=93=E3=81=A8=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- router/responses.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/router/responses.go b/router/responses.go index 81d11d64..fde97cfd 100644 --- a/router/responses.go +++ b/router/responses.go @@ -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のパターンマッチ @@ -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) } From b2f930b16db400797436bf219e8612e309331177 Mon Sep 17 00:00:00 2001 From: Sotatsu57 Date: Mon, 1 Jul 2024 18:22:01 +0900 Subject: [PATCH 76/77] =?UTF-8?q?main.yml=E6=9B=B8=E3=81=8D=E6=8F=9B?= =?UTF-8?q?=E3=81=88=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5c8d7c8e..b67dfc71 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version-file: 'go.mod' - uses: actions/checkout@v4 - uses: actions/cache@v3.3.2 with: @@ -33,7 +33,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version-file: 'go.mod' - uses: actions/checkout@v4 - uses: actions/cache@v3.3.2 with: @@ -68,7 +68,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version-file: 'go.mod' - uses: actions/checkout@v4 - uses: actions/cache@v3.3.2 with: @@ -99,7 +99,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version-file: 'go.mod' - uses: actions/checkout@v4 - name: golangci-lint uses: reviewdog/action-golangci-lint@v2.3 From fad7793e4d90f0a5fc888375a26c399b8b7a06bd Mon Sep 17 00:00:00 2001 From: Sotatsu57 Date: Mon, 1 Jul 2024 18:35:25 +0900 Subject: [PATCH 77/77] =?UTF-8?q?checkout=E3=81=AE=E9=A0=86=E7=95=AA?= =?UTF-8?q?=E3=82=92=E5=A4=89=E3=81=88=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b67dfc71..f4e032de 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,10 +15,10 @@ jobs: name: Mod runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version-file: 'go.mod' - - uses: actions/checkout@v4 - uses: actions/cache@v3.3.2 with: path: ~/go/pkg/mod @@ -31,10 +31,10 @@ jobs: env: GOCACHE: "/tmp/go/cache" steps: + - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version-file: 'go.mod' - - uses: actions/checkout@v4 - uses: actions/cache@v3.3.2 with: path: ~/go/pkg/mod @@ -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-file: 'go.mod' - - uses: actions/checkout@v4 - uses: actions/cache@v3.3.2 with: path: ~/go/pkg/mod @@ -97,10 +97,10 @@ jobs: name: Lint runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version-file: 'go.mod' - - uses: actions/checkout@v4 - name: golangci-lint uses: reviewdog/action-golangci-lint@v2.3 with: