Documentation ¶
Index ¶
- func CreateArticle(w http.ResponseWriter, r *http.Request)
- func CreateArticleRequestDTOToArticleModel(requestDTO articledto.CreateArticleRequestDTO, userID int64) models.Article
- func DeleteArticle(w http.ResponseWriter, r *http.Request)
- func ReadArticleByID(w http.ResponseWriter, r *http.Request)
- func ReadArticleByOffset(w http.ResponseWriter, r *http.Request)
- func UpdateArticle(w http.ResponseWriter, r *http.Request)
- func ValidateCreateArticleRequestDTO(requestDTO articledto.CreateArticleRequestDTO) error
- func ValidateReadArticleRequestDTO(requestDTO articledto.ReadArticleResponseDTO) error
- func ValidateUpdateArticleRequestDTO(requestDTO articledto.UpdateArticleRequestDTO) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateArticle ¶
func CreateArticle(w http.ResponseWriter, r *http.Request)
@Summary 기사 생성 @Description 기사를 생성합니다. @Tags Article tag @Accept json @Produce json @Param authorization header string true "jwt token" @Param createArticleReq body articledto.CreateArticleRequestDTO true "기사 생성 내용" @Success 201 {object} articledto.CreateArticleResponseWrapperDTO "정상적으로 생성됨" @Failure 400 {object} types.ErrorResponse "입력값이 유효하지 않음" @Failure 422 {object} types.ErrorResponse "요청을 제대로 수행하지 못함" @Failure 500 {object} types.ErrorResponse "네트워크 에러" @Router /user/{user_id}/article [post]
func CreateArticleRequestDTOToArticleModel ¶
func CreateArticleRequestDTOToArticleModel(requestDTO articledto.CreateArticleRequestDTO, userID int64) models.Article
func DeleteArticle ¶
func DeleteArticle(w http.ResponseWriter, r *http.Request)
@Summary Delete article @Description Delete article @Tags Article tag @Accept json @Produce json @Param authorization header string true "jwt token" @Param user_id path int true "article author id(기사 소유자)" @Param article_id path int true "article id(기사 ID)" @Success 204 "success" @Failure 400 {object} types.ErrorResponse "bad request" @Failure 422 {object} types.ErrorResponse "요청을 제대로 수행하지 못함" @Failure 500 {object} types.ErrorResponse "network error" @Router /user/{user_id}/article/{article_id} [delete]
func ReadArticleByID ¶
func ReadArticleByID(w http.ResponseWriter, r *http.Request)
@Summary Read article by id @Description Read article by id @Tags Article tag @Accept json @Produce json @Param user_id path int true "article author id(기사 소유자)" @Param article_id path int true "article id(기사 ID)" @Success 200 {object} articledto.ReadArticleResponseWrapperDTO "success" @Failure 400 {object} types.ErrorResponse "입력값이 유효하지 않음" @Failure 404 {object} types.ErrorResponse "기사를 찾을 수 없음" @Failure 422 {object} types.ErrorResponse "요청을 제대로 수행하지 못함" @Failure 500 {object} types.ErrorResponse "네트워크 에러" @Router /user/{user_id}/article/{article_id} [get]
func ReadArticleByOffset ¶
func ReadArticleByOffset(w http.ResponseWriter, r *http.Request)
@Summary Read article by offset @Description page, limit을 이용해서 article을 읽어옴(limit는 없는 경우 10으로 사용) @Tags Article tag @Accept json @Produce json @Param page header int false "page" @Param limit header int false "limit" @Success 200 {object} articledto.ReadArticleByOffsetResponseWrapperDTO "success" @Failure 400 {object} types.ErrorResponse "입력값이 유효하지 않음" @Failure 422 {object} types.ErrorResponse "요청을 제대로 수행하지 못함" @Failure 500 {object} types.ErrorResponse "네트워크 에러" @Router /articles [get]
func UpdateArticle ¶
func UpdateArticle(w http.ResponseWriter, r *http.Request)
@Summary Update article @Description Update article @Tags Article tag @Accept json @Produce json @Param authorization header string true "jwt token" @Param user_id path int true "article author id(기사 소유자)" @Param article_id path int true "article id(기사 ID)" @Param updateArticleReq body articledto.UpdateArticleRequestDTO true "updateArticleReq" @Success 200 {object} articledto.UpdateArticleResponseWrapperDTO "success" @Failure 400 {object} types.ErrorResponse "bad request" @Failure 422 {object} types.ErrorResponse "요청을 제대로 수행하지 못함" @Failure 500 {object} types.ErrorResponse "network error" @Router /user/{user_id}/article/{article_id} [put]
func ValidateCreateArticleRequestDTO ¶
func ValidateCreateArticleRequestDTO(requestDTO articledto.CreateArticleRequestDTO) error
func ValidateReadArticleRequestDTO ¶
func ValidateReadArticleRequestDTO(requestDTO articledto.ReadArticleResponseDTO) error
func ValidateUpdateArticleRequestDTO ¶
func ValidateUpdateArticleRequestDTO(requestDTO articledto.UpdateArticleRequestDTO) error
Types ¶
This section is empty.