diff --git a/docs/docs.go b/docs/docs.go index 876020313072ea2edf05d04216dd2a4533bca0ba..c5b288afb7d4ebf65f01ea69ee105082f3eacb9d 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -2245,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": { @@ -3120,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 7d7802bc413765ed1066d2f8d08270a03e5b116a..f3f2ef29c3d9a1582156765304d1ce443c097047 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 b39336da946758345aadf855e855615703b341ab..969534e24ffadab4aa54d3e304a57670f577cc4b 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/course/updateCourse.go b/handler/course/updateCourse.go index 4e2ded686a6281dd2e6baebd5b8868fdcf92c150..597bc92d4c8e3e20b43a008b94aea420a883f2e9 100644 --- a/handler/course/updateCourse.go +++ b/handler/course/updateCourse.go @@ -30,6 +30,7 @@ import ( // @Router /course/{id} [patch] func (c CourseHandlerImpl) UpdateCourse(w http.ResponseWriter, r *http.Request) { payload := course.UpdateCourseRequestPayload{} + payload.ID = chi.URLParam(r, "id") validate := validator.New() // Validate payload @@ -82,7 +83,6 @@ func (c CourseHandlerImpl) UpdateCourse(w http.ResponseWriter, r *http.Request) } payload.UpdateCourseToken = token[1] - payload.ID = chi.URLParam(r, "id") err := c.CourseService.UpdateCourse(payload) if err != nil { diff --git a/handler/quiz/new.go b/handler/quiz/new.go index ca9ce5ed0b1d32b4d8cab8f568ec5a24221bb175..2a9b65f2188116bc40925f62075dc27c2d2abc5e 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) {