changes...
This commit is contained in:
parent
41944884b4
commit
ab4b53fd40
26 changed files with 600 additions and 51 deletions
|
|
@ -4,7 +4,7 @@ import (
|
|||
"58team_blog/internal/application/commands"
|
||||
"58team_blog/internal/application/queries"
|
||||
"58team_blog/internal/application/services"
|
||||
"58team_blog/internal/interfaces/api/dto"
|
||||
"58team_blog/internal/interfaces/api/mapper"
|
||||
"58team_blog/internal/interfaces/api/requests"
|
||||
"58team_blog/internal/interfaces/api/responses"
|
||||
"log"
|
||||
|
|
@ -33,7 +33,7 @@ func CreatePostController(service *services.PostService) PostController {
|
|||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body requests.CreatePostRequest true "Post data"
|
||||
// @Success 200 {object} responses.PostResponse
|
||||
// @Success 201 {object} responses.PostResponse
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /post [post]
|
||||
|
|
@ -70,9 +70,9 @@ func (r *PostController) Post(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
response := dto.ResponseFromPostResult(res)
|
||||
response := mapper.ResponseFromPostResult(res)
|
||||
|
||||
c.JSON(http.StatusOK, response)
|
||||
c.JSON(http.StatusCreated, response)
|
||||
}
|
||||
|
||||
// GetAllPost godoc
|
||||
|
|
@ -93,7 +93,7 @@ func (r *PostController) GetAll(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
res := dto.ResponseFromPostGetAllResult(result)
|
||||
res := mapper.ResponseFromPostGetAllResult(result)
|
||||
|
||||
c.JSON(http.StatusOK, res)
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ func (r *PostController) GetAllWithOffset(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
res := dto.ResponseFromPostGetAllResult(result)
|
||||
res := mapper.ResponseFromPostGetAllResult(result)
|
||||
|
||||
c.JSON(http.StatusOK, res)
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ func (r *PostController) GetById(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
result := dto.ResponseFormPostFindByIdResult(posts)
|
||||
result := mapper.ResponseFormPostFindByIdResult(posts)
|
||||
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ func (r *PostController) Put(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
response := dto.ResponseFromPostResult(post)
|
||||
response := mapper.ResponseFromPostResult(post)
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue