From ce1a766624f6bf5615d94c3356a0390d518eeec4 Mon Sep 17 00:00:00 2001
From: Nathanael Santoso <13520129@std.stei.itb.ac.id>
Date: Fri, 28 Apr 2023 11:41:42 +0000
Subject: [PATCH] Revert "Merge branch
 'feat/s4-SB-54-Backend-Manajemen-Soal-Latihan' into 'main'"

This reverts merge request !37
---
 docs/docs.go                |  65 +-----------------
 docs/swagger.json           |  65 +-----------------
 docs/swagger.yaml           |  44 +------------
 handler/quiz/delete.go      |  86 ------------------------
 handler/quiz/get.go         |  76 ---------------------
 handler/quiz/new.go         |  94 --------------------------
 handler/quiz/type.go        |   3 -
 model/web/course/request.go |   2 +-
 model/web/error_code.go     |   1 -
 model/web/quiz/request.go   |  57 ----------------
 repository/quiz/impl.go     |  30 ---------
 repository/quiz/type.go     |   4 --
 routes/quiz/route.go        |  15 +----
 service/quiz/impl.go        | 127 ------------------------------------
 service/quiz/type.go        |   5 --
 utils/env/env.go            |   1 -
 16 files changed, 5 insertions(+), 670 deletions(-)
 delete mode 100644 handler/quiz/delete.go
 delete mode 100644 handler/quiz/new.go
 delete mode 100644 model/web/quiz/request.go

diff --git a/docs/docs.go b/docs/docs.go
index 5f078b3..49b75f3 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -1690,39 +1690,6 @@ const docTemplate = `{
                 }
             }
         },
-        "/quiz": {
-            "put": {
-                "description": "New Quiz",
-                "consumes": [
-                    "application/json"
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "tags": [
-                    "quiz"
-                ],
-                "summary": "New Quiz",
-                "parameters": [
-                    {
-                        "type": "string",
-                        "format": "uuid",
-                        "description": "Quiz id",
-                        "name": "id",
-                        "in": "path",
-                        "required": true
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "OK",
-                        "schema": {
-                            "$ref": "#/definitions/web.BaseResponse"
-                        }
-                    }
-                }
-            }
-        },
         "/quiz/{id}": {
             "get": {
                 "description": "Get Quiz Detail",
@@ -1766,37 +1733,6 @@ const docTemplate = `{
                         }
                     }
                 }
-            },
-            "delete": {
-                "description": "Delete Quiz",
-                "consumes": [
-                    "application/json"
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "tags": [
-                    "quiz"
-                ],
-                "summary": "Delete Quiz",
-                "parameters": [
-                    {
-                        "type": "string",
-                        "format": "uuid",
-                        "description": "Quiz id",
-                        "name": "id",
-                        "in": "path",
-                        "required": true
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "OK",
-                        "schema": {
-                            "$ref": "#/definitions/web.BaseResponse"
-                        }
-                    }
-                }
             }
         },
         "/quiz/{id}/solution": {
@@ -2090,6 +2026,7 @@ const docTemplate = `{
             "description": "Information that should be available when you add a course",
             "type": "object",
             "required": [
+                "abbreviation",
                 "email",
                 "id",
                 "name"
diff --git a/docs/swagger.json b/docs/swagger.json
index f17f85a..883d3d7 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -1682,39 +1682,6 @@
                 }
             }
         },
-        "/quiz": {
-            "put": {
-                "description": "New Quiz",
-                "consumes": [
-                    "application/json"
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "tags": [
-                    "quiz"
-                ],
-                "summary": "New Quiz",
-                "parameters": [
-                    {
-                        "type": "string",
-                        "format": "uuid",
-                        "description": "Quiz id",
-                        "name": "id",
-                        "in": "path",
-                        "required": true
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "OK",
-                        "schema": {
-                            "$ref": "#/definitions/web.BaseResponse"
-                        }
-                    }
-                }
-            }
-        },
         "/quiz/{id}": {
             "get": {
                 "description": "Get Quiz Detail",
@@ -1758,37 +1725,6 @@
                         }
                     }
                 }
-            },
-            "delete": {
-                "description": "Delete Quiz",
-                "consumes": [
-                    "application/json"
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "tags": [
-                    "quiz"
-                ],
-                "summary": "Delete Quiz",
-                "parameters": [
-                    {
-                        "type": "string",
-                        "format": "uuid",
-                        "description": "Quiz id",
-                        "name": "id",
-                        "in": "path",
-                        "required": true
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "OK",
-                        "schema": {
-                            "$ref": "#/definitions/web.BaseResponse"
-                        }
-                    }
-                }
             }
         },
         "/quiz/{id}/solution": {
@@ -2082,6 +2018,7 @@
             "description": "Information that should be available when you add a course",
             "type": "object",
             "required": [
+                "abbreviation",
                 "email",
                 "id",
                 "name"
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 30750e1..58ea934 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -85,6 +85,7 @@ definitions:
         description: Course Name
         type: string
     required:
+    - abbreviation
     - email
     - id
     - name
@@ -1547,50 +1548,7 @@ paths:
       summary: Delete Content
       tags:
       - content
-  /quiz:
-    put:
-      consumes:
-      - application/json
-      description: New Quiz
-      parameters:
-      - description: Quiz id
-        format: uuid
-        in: path
-        name: id
-        required: true
-        type: string
-      produces:
-      - application/json
-      responses:
-        "200":
-          description: OK
-          schema:
-            $ref: '#/definitions/web.BaseResponse'
-      summary: New Quiz
-      tags:
-      - quiz
   /quiz/{id}:
-    delete:
-      consumes:
-      - application/json
-      description: Delete Quiz
-      parameters:
-      - description: Quiz id
-        format: uuid
-        in: path
-        name: id
-        required: true
-        type: string
-      produces:
-      - application/json
-      responses:
-        "200":
-          description: OK
-          schema:
-            $ref: '#/definitions/web.BaseResponse'
-      summary: Delete Quiz
-      tags:
-      - quiz
     get:
       consumes:
       - application/json
diff --git a/handler/quiz/delete.go b/handler/quiz/delete.go
deleted file mode 100644
index 642e166..0000000
--- a/handler/quiz/delete.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package quiz
-
-import (
-	"net/http"
-	"strings"
-
-	"github.com/go-chi/chi/v5"
-	"github.com/google/uuid"
-	"gitlab.informatika.org/ocw/ocw-backend/model/web/quiz"
-	"gitlab.informatika.org/ocw/ocw-backend/model/web"
-)
-
-// Index godoc
-//
-//	@Tags					quiz
-//	@Summary			Delete Quiz
-//	@Description	Delete Quiz
-//	@Produce			json
-//	@Accept				json
-//	@Param				id path string true "Quiz id" Format(uuid)
-//	@Success			200	{object}	web.BaseResponse
-//	@Router				/quiz/{id} [delete]
-func (m QuizHandlerImpl) DeleteQuiz(w http.ResponseWriter, r *http.Request) {
-	payload := quiz.DeleteRequestPayload{}
-	quizId := chi.URLParam(r, "id")
-
-	if quizId == "" {
-		payload := m.WrapperUtil.ErrorResponseWrap("quiz id is required", nil)
-		m.HttpUtil.WriteJson(w, http.StatusUnsupportedMediaType, payload)
-		return
-	}
-
-	id, err := uuid.Parse(quizId)
-
-	if err != nil {
-		// invalid uuid
-		payload := m.WrapperUtil.ErrorResponseWrap(err.Error(), nil)
-		m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-		return
-	}
-
-	// Confirm Valid Website Token
-	validateTokenHeader := r.Header.Get("Authorization")
-
-	if validateTokenHeader == "" {
-		payload := m.WrapperUtil.ErrorResponseWrap("token is required", nil)
-		m.HttpUtil.WriteJson(w, http.StatusForbidden, payload)
-		return
-	}
-
-	token := strings.Split(validateTokenHeader, " ")
-
-	if len(token) != 2 {
-		payload := m.WrapperUtil.ErrorResponseWrap("invalid token", nil)
-		m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-		return
-	}
-
-	if token[0] != "Bearer" {
-		payload := m.WrapperUtil.ErrorResponseWrap("invalid token", nil)
-		m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-		return
-	}
-
-	payload.DeleteToken = token[1]
-	payload.ID = id
-
-	err = m.QuizService.DeleteQuiz(payload)
-
-	if err != nil {
-		respErr, ok := err.(web.ResponseError)
-		if ok {
-			payload := m.WrapperUtil.ErrorResponseWrap(respErr.Error(), respErr)
-
-			m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-		} else {
-			payload := m.WrapperUtil.ErrorResponseWrap("internal server error", nil)
-			m.HttpUtil.WriteJson(w, http.StatusInternalServerError, payload)
-		}
-		return
-	}
-
-	responsePayload := m.WrapperUtil.SuccessResponseWrap(nil)
-	m.HttpUtil.WriteSuccessJson(w, responsePayload)
-
-}
\ No newline at end of file
diff --git a/handler/quiz/get.go b/handler/quiz/get.go
index b88bde2..799ca82 100644
--- a/handler/quiz/get.go
+++ b/handler/quiz/get.go
@@ -2,12 +2,10 @@ package quiz
 
 import (
 	"net/http"
-	"strings"
 
 	"github.com/go-chi/chi/v5"
 	"github.com/google/uuid"
 	"gitlab.informatika.org/ocw/ocw-backend/model/web"
-	"gitlab.informatika.org/ocw/ocw-backend/model/web/quiz"
 )
 
 // Index godoc
@@ -57,77 +55,3 @@ func (m QuizHandlerImpl) GetQuizDetail(w http.ResponseWriter, r *http.Request) {
 	m.HttpUtil.WriteSuccessJson(w, responsePayload)
 
 }
-
-// Index godoc
-//
-//	@Tags					quiz
-//	@Summary			Get Quiz Link
-//	@Description	Get Quiz Link
-//	@Produce			json
-//	@Accept				json
-//	@Param				id path string true "Quiz id" Format(uuid)
-//	@Success			200	{object}	web.BaseResponse
-//	@Router				/quiz/link/{id} [get]
-
-func (m QuizHandlerImpl) GetQuizLink(w http.ResponseWriter, r *http.Request) {
-	payload := quiz.UpdateQuizRequestPayload{}
-	quizId := chi.URLParam(r, "id")
-
-	if quizId == "" {
-		payload := m.WrapperUtil.ErrorResponseWrap("quiz id is required", nil)
-		m.HttpUtil.WriteJson(w, http.StatusUnsupportedMediaType, payload)
-		return
-	}
-
-	id, err := uuid.Parse(quizId)
-
-	if err != nil {
-		// invalid uuid
-		payload := m.WrapperUtil.ErrorResponseWrap(err.Error(), nil)
-		m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-		return
-	}
-	
-	// Confirm Valid Website Token
-	validateTokenHeader := r.Header.Get("Authorization")
-
-	if validateTokenHeader == "" {
-		payload := m.WrapperUtil.ErrorResponseWrap("token is required", nil)
-		m.HttpUtil.WriteJson(w, http.StatusForbidden, payload)
-		return
-	}
-
-	token := strings.Split(validateTokenHeader, " ")
-
-	if len(token) != 2 {
-		payload := m.WrapperUtil.ErrorResponseWrap("invalid token", nil)
-		m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-		return
-	}
-
-	if token[0] != "Bearer" {
-		payload := m.WrapperUtil.ErrorResponseWrap("invalid token", nil)
-		m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-		return
-	}
-
-	payload.UpdateQuizToken = token[1]
-	payload.ID = id
-	response, err := m.QuizService.GetQuiz(payload)
-
-	if err != nil {
-		respErr, ok := err.(web.ResponseError)
-		if ok {
-			payload := m.WrapperUtil.ErrorResponseWrap(respErr.Error(), respErr)
-
-			m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-		} else {
-			payload := m.WrapperUtil.ErrorResponseWrap("internal server error", nil)
-			m.HttpUtil.WriteJson(w, http.StatusInternalServerError, payload)
-		}
-		return
-	}
-
-	responsePayload := m.WrapperUtil.SuccessResponseWrap(response)
-	m.HttpUtil.WriteSuccessJson(w, responsePayload)
-}
diff --git a/handler/quiz/new.go b/handler/quiz/new.go
deleted file mode 100644
index ca9ce5e..0000000
--- a/handler/quiz/new.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package quiz
-
-import (
-	"net/http"
-	"strings"
-
-	"github.com/go-playground/validator/v10"
-	"gitlab.informatika.org/ocw/ocw-backend/model/web"
-	"gitlab.informatika.org/ocw/ocw-backend/model/web/quiz"
-)
-
-// Index godoc
-//
-//	@Tags					quiz
-//	@Summary			New Quiz
-//	@Description	New Quiz
-//	@Produce			json
-//	@Accept				json
-//	@Param				id path string true "Quiz id" Format(uuid)
-//	@Success			200	{object}	web.BaseResponse
-//	@Router				/quiz [put]
-func (m QuizHandlerImpl) NewQuiz(w http.ResponseWriter, r *http.Request) {
-	payload := quiz.AddQuizRequestPayload{}
-
-	// Validate payload
-	if r.Header.Get("Content-Type") != "application/json" {
-		payload := m.WrapperUtil.ErrorResponseWrap("this service only receive json input", nil)
-		m.HttpUtil.WriteJson(w, http.StatusUnsupportedMediaType, payload)
-		return
-	}
-
-	if err := m.HttpUtil.ParseJson(r, &payload); err != nil {
-		payload := m.WrapperUtil.ErrorResponseWrap("invalid json input", err.Error())
-		m.HttpUtil.WriteJson(w, http.StatusUnprocessableEntity, payload)
-		return
-	}
-
-	validate := validator.New()
-	if err := validate.Struct(payload); err != nil {
-		if _, ok := err.(*validator.InvalidValidationError); ok {
-			payload := m.WrapperUtil.ErrorResponseWrap(err.Error(), nil)
-			m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-			return
-		}
-
-		errPayload := web.NewResponseErrorFromValidator(err.(validator.ValidationErrors))
-		payload := m.WrapperUtil.ErrorResponseWrap(errPayload.Error(), errPayload)
-		m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-		return
-	}
-
-	// Confirm Valid Website Token
-	validateTokenHeader := r.Header.Get("Authorization")
-
-	if validateTokenHeader == "" {
-		payload := m.WrapperUtil.ErrorResponseWrap("token is required", nil)
-		m.HttpUtil.WriteJson(w, http.StatusForbidden, payload)
-		return
-	}
-
-	token := strings.Split(validateTokenHeader, " ")
-
-	if len(token) != 2 {
-		payload := m.WrapperUtil.ErrorResponseWrap("invalid token", nil)
-		m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-		return
-	}
-
-	if token[0] != "Bearer" {
-		payload := m.WrapperUtil.ErrorResponseWrap("invalid token", nil)
-		m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-		return
-	}
-
-	payload.AddQuizToken = token[1]
-
-	response, err := m.QuizService.NewQuiz(payload)
-
-	if err != nil {
-		respErr, ok := err.(web.ResponseError)
-		if ok {
-			payload := m.WrapperUtil.ErrorResponseWrap(respErr.Error(), respErr)
-
-			m.HttpUtil.WriteJson(w, http.StatusBadRequest, payload)
-		} else {
-			payload := m.WrapperUtil.ErrorResponseWrap("internal server error", nil)
-			m.HttpUtil.WriteJson(w, http.StatusInternalServerError, payload)
-		}
-		return
-	}
-
-	responsePayload := m.WrapperUtil.SuccessResponseWrap(response)
-	m.HttpUtil.WriteSuccessJson(w, responsePayload)
-}
\ No newline at end of file
diff --git a/handler/quiz/type.go b/handler/quiz/type.go
index 306cc81..8c3bf6f 100644
--- a/handler/quiz/type.go
+++ b/handler/quiz/type.go
@@ -9,7 +9,4 @@ type QuizHandler interface {
 	TakeQuiz(w http.ResponseWriter, r *http.Request)
 	GetQuizSolution(w http.ResponseWriter, r *http.Request)
 	FinishQuiz(w http.ResponseWriter, r *http.Request)
-	NewQuiz(w http.ResponseWriter, r *http.Request)
-	GetQuizLink(w http.ResponseWriter, r *http.Request)
-	DeleteQuiz(w http.ResponseWriter, r *http.Request)
 }
diff --git a/model/web/course/request.go b/model/web/course/request.go
index 70bb3c8..0fad2be 100644
--- a/model/web/course/request.go
+++ b/model/web/course/request.go
@@ -27,7 +27,7 @@ type AddCourseRequestPayload struct {
 	Email string `json:"email" validate:"required,email" example:"someone@example.com"`
 
 	// Course Name Abbreviation
-	Abbreviation string `json:"abbreviation"`
+	Abbreviation string `json:"abbreviation" validate:"required"`
 }
 
 // DeleteCourse Request Payload
diff --git a/model/web/error_code.go b/model/web/error_code.go
index 764d536..9b29b2d 100644
--- a/model/web/error_code.go
+++ b/model/web/error_code.go
@@ -13,7 +13,6 @@ const (
 	MajorNotExist      string = "MAJOR_NOT_EXIST"
 	CourseNotExist     string = "COURSE_NOT_EXIST"
 	IDExists           string = "ID_ALREADY_EXISTS"
-	NotExist           string = "NOT_EXIST"
 
 	TokenError string = "TOKEN_ERROR"
 )
diff --git a/model/web/quiz/request.go b/model/web/quiz/request.go
deleted file mode 100644
index 7aa6627..0000000
--- a/model/web/quiz/request.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package quiz
-
-import (
-	"github.com/google/uuid"
-)
-
-// AddQuiz Request Payload
-//
-//	@Description	Information that should be available when you add a quiz
-type AddQuizRequestPayload struct {
-	// Web Token that was appended to the link
-	AddQuizToken string
-
-	// Quiz Name
-	Name string `json:"name" validate:"required"`
-
-	// Course ID
-	CourseID string `json:"course_id" validate:"required"`
-}
-
-// UpdateQuiz Request Payload
-//
-//	@Description	Information that should be available when you update a quiz
-type UpdateQuizRequestPayload struct {
-	// Web Token that was appended to the link
-	UpdateQuizToken string
-
-	// Quiz ID, Set by param
-	ID uuid.UUID `json:"id"`
-}
-
-// DeleteQuiz Request Payload
-//
-//	@Description	Information that should be available when you delete using uuid
-type DeleteRequestPayload struct {
-	// Web Token that was appended to the link
-	DeleteToken string
-
-	// Quiz ID, Set by param
-	ID uuid.UUID
-}
-
-// GetUUID Request Payload
-//
-//	@Description	Information that should be available when you get using uuid
-type GetRequestPayload struct {
-	// Quiz/Problem/Answer ID, provided by query
-	ID uuid.UUID
-}
-
-// Link Response Payload
-//
-//	@Description	Information that you will get upon successful request
-type LinkResponse struct {
-	UploadLink string `json:"upload_link"`
-}
-
diff --git a/repository/quiz/impl.go b/repository/quiz/impl.go
index 36818e4..e514954 100644
--- a/repository/quiz/impl.go
+++ b/repository/quiz/impl.go
@@ -5,7 +5,6 @@ import (
 	"time"
 
 	"github.com/google/uuid"
-	"gitlab.informatika.org/ocw/ocw-backend/model/domain/course"
 	"gitlab.informatika.org/ocw/ocw-backend/model/domain/quiz"
 	"gitlab.informatika.org/ocw/ocw-backend/model/web"
 	"gitlab.informatika.org/ocw/ocw-backend/provider/db"
@@ -64,35 +63,6 @@ func (q *QuizRepositoryImpl) NewTake(quizId uuid.UUID, userEmail string) (uuid.U
 	return id, err
 }
 
-func (q *QuizRepositoryImpl) IsUserContributor(id string, email string) (bool, error) {
-	err := q.db.Where("id = ? AND email = ?", id, email).Find(&course.Course{}).Error
-
-	if err != nil {
-		return false, err
-	}
-
-	return true, nil
-}
-
-func(q *QuizRepositoryImpl) NewQuiz(quiz quiz.Quiz) error {
-	return q.db.Create(&quiz).Error
-}
-
-func(q *QuizRepositoryImpl) GetQuizPath(quizId uuid.UUID) (string, error) {
-	result := quiz.Quiz{}
-	err := q.db.Where("id = ?", quizId).Find(&result).Error
-
-	if err != nil {
-		return "", err
-	}
-
-	return result.QuizPath, nil
-}
-
-func(q *QuizRepositoryImpl) Delete(quizId uuid.UUID) error {
-	return q.db.Delete(&quiz.Quiz{}, quizId).Error
-}
-
 func (q *QuizRepositoryImpl) IsActiveTake(quizId uuid.UUID, userEmail string) (bool, error) {
 	result := struct{ cnt int }{}
 	err := q.db.
diff --git a/repository/quiz/type.go b/repository/quiz/type.go
index c558fc0..1b4e0cb 100644
--- a/repository/quiz/type.go
+++ b/repository/quiz/type.go
@@ -10,10 +10,6 @@ type QuizRepository interface {
 	GetQuizDetail(quizId uuid.UUID) (*quiz.Quiz, error)
 	UpdateScore(takeId uuid.UUID, score int) error
 	NewTake(quizId uuid.UUID, userEmail string) (uuid.UUID, error)
-	IsUserContributor(id string, email string) (bool, error)
-	NewQuiz(quiz quiz.Quiz) error
-	GetQuizPath(quizId uuid.UUID) (string, error)
-	Delete(quizId uuid.UUID) error 
 	IsActiveTake(quizId uuid.UUID, userEmail string) (bool, error)
 	GetAllTake(quizId uuid.UUID, userEmail string) ([]quiz.QuizTake, error)
 	GetLastTake(quizId uuid.UUID, userEmail string) (*quiz.QuizTake, error)
diff --git a/routes/quiz/route.go b/routes/quiz/route.go
index e706bb1..b892694 100644
--- a/routes/quiz/route.go
+++ b/routes/quiz/route.go
@@ -14,6 +14,7 @@ type QuizRoutes struct {
 
 func (q QuizRoutes) Register(r chi.Router) {
 	r.Get("/course/{id}/quiz", q.QuizHandler.GetAllQuizes)
+	r.Get("/quiz/{id}", q.QuizHandler.GetQuizDetail)
 
 	guard := q.GuardBuilder.Build(
 		user.Student,
@@ -35,18 +36,4 @@ func (q QuizRoutes) Register(r chi.Router) {
 		r.Use(guard)
 		r.Get("/", q.QuizHandler.GetQuizSolution)
 	})
-
-	r.Route("/quiz/{id}", func(r chi.Router) {
-		r.Get("/", q.QuizHandler.GetQuizDetail)
-		r.Route("/", func(r chi.Router) {
-			r.Use(guard)
-			r.Put("/", q.QuizHandler.NewQuiz)
-			r.Delete("/", q.QuizHandler.DeleteQuiz)
-		})
-	})
-
-	r.Route("/quiz/link/{id}", func(r chi.Router) {
-		r.Use(guard)
-		r.Get("/", q.QuizHandler.GetQuizLink)
-	})
 }
diff --git a/service/quiz/impl.go b/service/quiz/impl.go
index e6ca76e..3898cd4 100644
--- a/service/quiz/impl.go
+++ b/service/quiz/impl.go
@@ -4,34 +4,19 @@ import (
 	"bytes"
 	"context"
 	"encoding/json"
-	"errors"
-	"fmt"
-	"strings"
 
 	"github.com/google/uuid"
 	"gitlab.informatika.org/ocw/ocw-backend/model/domain/quiz"
-	"gitlab.informatika.org/ocw/ocw-backend/model/domain/user"
 	"gitlab.informatika.org/ocw/ocw-backend/model/web"
-	model "gitlab.informatika.org/ocw/ocw-backend/model/web/quiz"
-	atoken "gitlab.informatika.org/ocw/ocw-backend/model/web/auth/token"
 	"gitlab.informatika.org/ocw/ocw-backend/provider/storage"
 	quizRepo "gitlab.informatika.org/ocw/ocw-backend/repository/quiz"
-	"gitlab.informatika.org/ocw/ocw-backend/service/logger"
-	"gitlab.informatika.org/ocw/ocw-backend/utils/env"
-	"gitlab.informatika.org/ocw/ocw-backend/utils/token"
-	"gorm.io/gorm"
 )
 
 type QuizServiceImpl struct {
 	quizRepo.QuizRepository
 	storage.Storage
-	token.TokenUtil
-	logger.Logger
-	*env.Environment
 }
 
-
-// TODO: should be for admins, make ones for users which doesnt expose minio link
 func (q QuizServiceImpl) ListAllQuiz(courseId string) ([]quiz.Quiz, error) {
 	return q.QuizRepository.GetQuizes(courseId)
 }
@@ -185,115 +170,3 @@ func (q QuizServiceImpl) DoFinishQuiz(ctx context.Context, quizId uuid.UUID, ema
 
 	return data, nil
 }
-
-func (q QuizServiceImpl) isQuizContributor(courseId string, email string) error {
-	_, err := q.QuizRepository.IsUserContributor(courseId, email)
-
-	if err != nil {
-		if errors.Is(err, gorm.ErrRecordNotFound) {
-			return web.NewResponseError("course and user combination not found", "NOT_OWNER")
-		}
-
-		return err
-	}
-
-	return nil
-}
-
-func (q QuizServiceImpl) NewQuiz(payload model.AddQuizRequestPayload) (*model.LinkResponse, error) {
-	// Validate Role
-	claim, err := q.TokenUtil.Validate(payload.AddQuizToken, atoken.Access)
-
-	// Invalid Token
-	if err != nil {
-		return &model.LinkResponse{}, web.NewResponseErrorFromError(err, web.TokenError)
-	}
-
-	// Unauthorized Role
-	if claim.Role == user.Student {
-		return &model.LinkResponse{}, web.NewResponseErrorFromError(err, web.UnauthorizedAccess)
-	}
-	
-	// Validate Ownership
-	if err := q.isQuizContributor(payload.CourseID, claim.Email); err != nil {
-		return &model.LinkResponse{}, err
-	}
-
-	path := fmt.Sprintf("%s/%s.json", q.BucketQuizBasePath, strings.ReplaceAll(uuid.New().String(), "-", ""))
-	uploadLink, err := q.Storage.CreatePutSignedLink(context.Background(), path)
-
-	if err != nil {
-		q.Logger.Error("Some error happened when generate link")
-		q.Logger.Error(err.Error())
-		return &model.LinkResponse{}, err
-	}
-
-	return &model.LinkResponse{UploadLink: uploadLink}, nil
-}
-
-func (q QuizServiceImpl) GetQuiz(payload model.UpdateQuizRequestPayload) (*model.LinkResponse, error) {
-	// Validate Role
-	claim, err := q.TokenUtil.Validate(payload.UpdateQuizToken, atoken.Access)
-
-	// Invalid Token
-	if err != nil {
-		return &model.LinkResponse{}, web.NewResponseErrorFromError(err, web.TokenError)
-	}
-
-	// Unauthorized Role
-	if claim.Role == user.Student {
-		return &model.LinkResponse{}, web.NewResponseErrorFromError(err, web.UnauthorizedAccess)
-	}
-
-	// Get Quiz Detail
-	quiz, err := q.QuizRepository.GetQuizDetail(payload.ID)
-
-	if err != nil {
-		return &model.LinkResponse{}, err
-	}
-
-	// Validate Ownership
-	if err := q.isQuizContributor(quiz.CourseId, claim.Email); err != nil {
-		return &model.LinkResponse{}, err
-	}
-
-	uploadLink, err := q.QuizRepository.GetQuizPath(payload.ID)
-
-	if err != nil {
-		q.Logger.Error("Some error happened when retrieving link")
-		q.Logger.Error(err.Error())
-		return &model.LinkResponse{}, err
-	}
-
-	return &model.LinkResponse{UploadLink: uploadLink}, nil
-}
-
-func (q QuizServiceImpl) DeleteQuiz(payload model.DeleteRequestPayload) error {
-	// Validate Role
-	claim, err := q.TokenUtil.Validate(payload.DeleteToken, atoken.Access)
-
-	// Invalid Token
-	if err != nil {
-		return web.NewResponseErrorFromError(err, web.TokenError)
-	}
-
-	// Unauthorized Role
-	if claim.Role == user.Student {
-		return web.NewResponseErrorFromError(err, web.UnauthorizedAccess)
-	}
-
-	// Get Quiz Detail
-	quiz, err := q.QuizRepository.GetQuizDetail(payload.ID)
-
-	if err != nil {
-		return err
-	}
-
-	// Validate Ownership
-	if err := q.isQuizContributor(quiz.CourseId, claim.Email); err != nil {
-		return err
-	}
-
-	return q.QuizRepository.Delete(payload.ID)
-}
-
diff --git a/service/quiz/type.go b/service/quiz/type.go
index 616546c..7c97e49 100644
--- a/service/quiz/type.go
+++ b/service/quiz/type.go
@@ -5,7 +5,6 @@ import (
 
 	"github.com/google/uuid"
 	"gitlab.informatika.org/ocw/ocw-backend/model/domain/quiz"
-	model "gitlab.informatika.org/ocw/ocw-backend/model/web/quiz"
 )
 
 type QuizService interface {
@@ -15,8 +14,4 @@ type QuizService interface {
 	DoTakeQuiz(ctx context.Context, quizId uuid.UUID, email string) (*quiz.QuizDetail, error)
 	DoFinishQuiz(ctx context.Context, quizId uuid.UUID, email string, studentAnswer []quiz.Response) (*quiz.QuizTake, error)
 	GetSolutionQuiz(ctx context.Context, quizId uuid.UUID, email string) (*quiz.QuizDetail, error)
-	isQuizContributor(courseId string, email string) error
-	NewQuiz(payload model.AddQuizRequestPayload) (*model.LinkResponse, error)
-	GetQuiz(payload model.UpdateQuizRequestPayload) (*model.LinkResponse, error)
-	DeleteQuiz(payload model.DeleteRequestPayload) error
 }
diff --git a/utils/env/env.go b/utils/env/env.go
index 729a7f2..ff09c00 100644
--- a/utils/env/env.go
+++ b/utils/env/env.go
@@ -63,7 +63,6 @@ type Environment struct {
 	BucketSignedGetDuration int64 `env:"BUCKET_SIGNED_GET_DURATION_S" envDefault:"1800"`
 
 	BucketMaterialBasePath string `env:"BUCKET_MATERIAL_BASE_PATH" envDefault:"materials"`
-	BucketQuizBasePath string `env:"BUCKET_MATERIAL_BASE_PATH" envDefault:"quiz"`
 
 	UseBucket bool `env:"USE_BUCKET" envDefault:"true"`
 }
-- 
GitLab