From 9b37a1715d15b9a82b07284cab586c02202ca22c Mon Sep 17 00:00:00 2001 From: nart4hire <13520129@std.stei.itb.ac.id> Date: Fri, 28 Apr 2023 20:47:06 +0700 Subject: [PATCH] fix(quiz): added swag doc for request --- docs/docs.go | 34 ++++++++++++++++++++++++++++++++-- docs/swagger.json | 31 +++++++++++++++++++++++++++++++ docs/swagger.yaml | 22 ++++++++++++++++++++++ handler/quiz/new.go | 1 + 4 files changed, 86 insertions(+), 2 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 74678c2..c5b288a 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,5 +1,4 @@ -// Code generated by swaggo/swag. DO NOT EDIT. - +// Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" @@ -2246,6 +2245,15 @@ const docTemplate = `{ "name": "id", "in": "path", "required": true + }, + { + "description": "Add Course payload", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/quiz.AddQuizRequestPayload" + } } ], "responses": { @@ -3121,6 +3129,28 @@ const docTemplate = `{ } } }, + "quiz.AddQuizRequestPayload": { + "description": "Information that should be available when you add a quiz", + "type": "object", + "required": [ + "course_id", + "name" + ], + "properties": { + "addQuizToken": { + "description": "Web Token that was appended to the link", + "type": "string" + }, + "course_id": { + "description": "Course ID", + "type": "string" + }, + "name": { + "description": "Quiz Name", + "type": "string" + } + } + }, "quiz.AnswerOption": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 7d7802b..f3f2ef2 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -2237,6 +2237,15 @@ "name": "id", "in": "path", "required": true + }, + { + "description": "Add Course payload", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/quiz.AddQuizRequestPayload" + } } ], "responses": { @@ -3112,6 +3121,28 @@ } } }, + "quiz.AddQuizRequestPayload": { + "description": "Information that should be available when you add a quiz", + "type": "object", + "required": [ + "course_id", + "name" + ], + "properties": { + "addQuizToken": { + "description": "Web Token that was appended to the link", + "type": "string" + }, + "course_id": { + "description": "Course ID", + "type": "string" + }, + "name": { + "description": "Quiz Name", + "type": "string" + } + } + }, "quiz.AnswerOption": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index b39336d..969534e 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -380,6 +380,22 @@ definitions: - lesson_id - order type: object + quiz.AddQuizRequestPayload: + description: Information that should be available when you add a quiz + properties: + addQuizToken: + description: Web Token that was appended to the link + type: string + course_id: + description: Course ID + type: string + name: + description: Quiz Name + type: string + required: + - course_id + - name + type: object quiz.AnswerOption: properties: answer: @@ -1997,6 +2013,12 @@ paths: name: id required: true type: string + - description: Add Course payload + in: body + name: data + required: true + schema: + $ref: '#/definitions/quiz.AddQuizRequestPayload' produces: - application/json responses: diff --git a/handler/quiz/new.go b/handler/quiz/new.go index ca9ce5e..2a9b65f 100644 --- a/handler/quiz/new.go +++ b/handler/quiz/new.go @@ -17,6 +17,7 @@ import ( // @Produce json // @Accept json // @Param id path string true "Quiz id" Format(uuid) +// @Param data body quiz.AddQuizRequestPayload true "Add Quiz payload" // @Success 200 {object} web.BaseResponse // @Router /quiz [put] func (m QuizHandlerImpl) NewQuiz(w http.ResponseWriter, r *http.Request) { -- GitLab