Swag Tags

This commit is contained in:
2023-11-17 14:27:42 +09:00
parent 5b5870f354
commit 7efa198a3f
23 changed files with 281 additions and 216 deletions

View File

@ -30,7 +30,8 @@ func NewAuthController(service services.AuthService, tokenService services.Token
//
// @Summary 회원가입
// @Description username, name, password 를 입력하여 회원가입
// @Accept json
// @Tags 회원가입
// @Accept json
// @Produce json
//
// @Param username body string true "username"
@ -64,6 +65,7 @@ func (controller *authController) Register(c *gin.Context) {
//
// @Summary 로그인
// @Description username, password 를 입력하여 로그인
// @Tags 로그인
// @Accept json
// @Produce json
//

View File

@ -32,16 +32,19 @@ func NewProgramController(service services.ProgramService) ProgramController {
// Program List
//
// @Summary 프로그램 목록 가져오기
// @Description 퀴즈 프로그램 목록을 가져옵니다.
// @Summary 프로그램 목록 가져오기
// @Description 퀴즈 프로그램 목록을 가져옵니다.
// @Tags Program
//
// @Accept json
// @Produce json
//
// @Param tag query string false "태그"
// @Param q query string false "검색어"
// @Param page query int false "페이지"
// @Param limit query int false "페이지 사이즈"
//
// @Success 200 {object} models.ProgramListResponse
// @Security ApiKeyAuth
// @Router /program [get]
func (controller *programController) List(c *gin.Context) {
tag := c.DefaultQuery("tag", "")
@ -86,13 +89,16 @@ func (controller *programController) List(c *gin.Context) {
// Get program
//
// @Summary 퀴즈 프로그램 가져오기
// @Description ID로 퀴즈 프로그램을 가져옵니다.
// @Summary 퀴즈 프로그램 가져오기
// @Description ID로 퀴즈 프로그램을 가져옵니다.
// @Tags Program
//
// @Accept json
// @Produce json
//
// @Param id path string true "퀴즈 프로그램 ID"
//
// @Success 200 {object} models.ProgramResponse
// @Failure 400
// @Router /program/{id} [get]
func (controller *programController) Find(c *gin.Context) {
id := c.Param("id")
@ -108,18 +114,22 @@ func (controller *programController) Find(c *gin.Context) {
// Create Program
//
// @Summary 퀴즈 프로그램 생성
// @Description 퀴즈 프로그램을 만듭니다.
// @Summary 퀴즈 프로그램 생성
// @Description 퀴즈 프로그램을 만듭니다.
// @Tags Program
//
// @Accept json
// @Produce json
//
// @Param subject body string true "프로그램 제목"
// @Param course body string true "프로그램 코스"
// @Param content body string true "프로그램 내용"
// @Param tag body []string true "프로그램 태그"
// @Param status body string true "프로그램 상태 on 또는 off"
// @Param publish_at body string true "프로그램 발행 날짜"
// @Router /program [post]
//
// @Success 200 {object} models.ProgramResponse
// @Router /program [post]
func (controller *programController) Create(c *gin.Context) {
var request models.ProgramRequest
if err := c.ShouldBindJSON(&request); err != nil {
@ -157,18 +167,22 @@ func (controller *programController) Create(c *gin.Context) {
// Update Program
//
// @Summary 퀴즈 프로그램 수정
// @Summary 퀴즈 프로그램 수정
// @Description 퀴즈 프로그램을 수정합니다.
// @Tags Program
//
// @Accept json
// @Produce json
//
// @Param subject body string true "프로그램 제목"
// @Param course body string true "프로그램 코스"
// @Param content body string true "프로그램 내용"
// @Param tag body []string true "프로그램 태그"
// @Param status body string true "프로그램 상태 on 또는 off"
// @Param publish_at body string true "프로그램 발행 날짜"
// @Router /program [put]
//
// @Success 200 {object} models.ProgramResponse
// @Router /program [put]
func (controller *programController) Update(c *gin.Context) {
id := c.Param("id")
var request models.ProgramRequest

View File

@ -34,12 +34,16 @@ func NewQuizController(service services.QuizService) QuizController {
//
// @Summary 퀴즈 목록 가져오기
// @Description 퀴즈 목록을 가져옵니다.
// @Tags Quiz
//
// @Accept json
// @Produce json
//
// @Param program_id query string true "프로그램 ID"
// @Param q query string false "검색어"
// @Param page query int false "페이지"
// @Param limit query int false "페이지 사이즈"
//
// @Success 200 {object} models.QuizListResponse
// @Router /quiz [get]
func (controller *quizController) List(c *gin.Context) {
@ -78,11 +82,14 @@ func (controller *quizController) List(c *gin.Context) {
//
// @Summary 퀴즈 가져오기
// @Description ID로 퀴즈를 가져옵니다.
// @Tags Quiz
//
// @Accept json
// @Produce json
//
// @Param id path string true "퀴즈 ID"
//
// @Success 200 {object} models.QuizResponse
// @Failure 400
// @Router /quiz/{id} [get]
func (controller *quizController) Find(c *gin.Context) {
id := c.Param("id")
@ -100,8 +107,11 @@ func (controller *quizController) Find(c *gin.Context) {
//
// @Summary 퀴즈 생성
// @Description 퀴즈를 만듭니다.
// @Tags Quiz
//
// @Accept json
// @Produce json
//
// @Param program_id body string true "프로그램 ID"
// @Param sequence body int true "퀴즈 순서"
// @Param quiz_type body string true "퀴즈 타입 : choice, check, ox, input"
@ -110,6 +120,7 @@ func (controller *quizController) Find(c *gin.Context) {
// @Param answer body []string true "퀴즈 정답 : [1,3]"
// @Param hint body string true "퀴즈 힌트"
// @Param comment body string true "퀴즈 해설"
//
// @Success 200 {object} models.QuizResponse
// @Router /quiz [post]
func (controller *quizController) Create(c *gin.Context) {
@ -146,8 +157,11 @@ func (controller *quizController) Create(c *gin.Context) {
//
// @Summary 퀴즈 수정
// @Description 퀴즈를 수정합니다.
// @Tags Quiz
//
// @Accept json
// @Produce json
//
// @Param id path string true "퀴즈 ID"
// @Param program_id body string true "프로그램 ID"
// @Param sequence body int true "퀴즈 순서"
@ -157,6 +171,7 @@ func (controller *quizController) Create(c *gin.Context) {
// @Param answer body []string true "퀴즈 정답 : [1,3]"
// @Param hint body string true "퀴즈 힌트"
// @Param comment body string true "퀴즈 해설"
//
// @Success 200 {object} models.QuizResponse
// @Router /quiz [put]
func (controller *quizController) Update(c *gin.Context) {

View File

@ -25,11 +25,15 @@ func NewTokenController(service services.TokenService) TokenController {
// Refresh Token
//
// @Summary AccessToken Refresh
// @Description AccessToken을 RefreshToken으로 갱신합니다.
// @Summary AccessToken Refresh
// @Description AccessToken을 RefreshToken으로 갱신합니다.
// @Tags Token
//
// @Accept json
// @Produce json
//
// @Param refresh_token body string true "RefreshToken"
//
// @Router /token/refresh [post]
// @Success 200 {object} models.ProgramResponse
func (controller *tokenController) Refresh(c *gin.Context) {

View File

@ -30,8 +30,9 @@ func NewUserController(service services.UserService, tokenService services.Token
// User List
//
// @Summary 사용자 목록 가져오기
// @Summary 사용자 목록 가져오기
// @Description 사용자 목록을 가져옵니다.
// @Tags User
// @Accept json
// @Produce json
//
@ -85,13 +86,15 @@ func (controller *userController) List(c *gin.Context) {
// Get User
//
// @Summary 사용자 정보 가져오기
// @Description ID로 사용자 정보를 가져옵니다.
// @Summary 사용자 정보 가져오기
// @Description ID로 사용자 정보를 가져옵니다.
// @Tags User
// @Accept json
// @Produce json
//
// @Param id path string true "사용자 ID"
//
// @Success 200 {object} models.User
// @Failure 400
// @Router /user/{id} [get]
func (controller *userController) Find(c *gin.Context) {
id := c.Param("id")