73 lines
2.2 KiB
Go
73 lines
2.2 KiB
Go
package handlers
|
|
|
|
import (
|
|
"gitea.d3m0k1d.ru/d3m0k1d/d3m0k1d.ru/backend/internal/logger"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type CommentsHandlers struct {
|
|
logger *logger.Logger
|
|
}
|
|
|
|
func NewCommentsHandlers() *CommentsHandlers {
|
|
return &CommentsHandlers{logger: logger.New(false)}
|
|
}
|
|
|
|
// GetAllComments godoc
|
|
// @Summary Get all comments
|
|
// @Description Get all comments
|
|
// @Tags comments
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Success 200 {object} models.SuccessResponse{data=[]storage.Comment}
|
|
// @Failure 404 {object} models.ErrorResponse "No Comment found"
|
|
// @Failure 500 {object} models.ErrorResponse "Internal server error"
|
|
// @Router /comments [get]
|
|
func (h *CommentsHandlers) GetAllComments(c *gin.Context) {
|
|
}
|
|
|
|
// GetCommentsOfPost godoc
|
|
// @Summary Get comments of post
|
|
// @Description Get comments of post
|
|
// @Tags comments
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param id path int true "Post ID"
|
|
// @Success 200 {object} models.SuccessResponse{data=[]storage.Comment}
|
|
// @Failure 404 {object} models.ErrorResponse "No Comment found"
|
|
// @Failure 500 {object} models.ErrorResponse "Internal server error"
|
|
// @Router /posts/{id}/comments [get]
|
|
func (h *CommentsHandlers) GetCommentsOfPost(c *gin.Context) {
|
|
}
|
|
|
|
// CreateComment godoc
|
|
// @Summary Create comment
|
|
// @Description Create new comment
|
|
// @Tags comments
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param comment body storage.CommentCreate true "Comment data"
|
|
// @Security Bearer
|
|
// @Success 200 {object} models.SuccessResponse{data=storage.Comment}
|
|
// @Failure 400 {object} models.ErrorResponse "Invalid request"
|
|
// @Failure 500 {object} models.ErrorResponse "Internal server error"
|
|
// @Router /comments [post]
|
|
func (h *CommentsHandlers) CreateComment(c *gin.Context) {
|
|
}
|
|
|
|
// DeleteComment godoc
|
|
// @Summary Delete comment
|
|
// @Description Delete comment
|
|
// @Tags admin
|
|
// @Security Bearer
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param id path int true "Comment ID"
|
|
// @Success 200 {object} models.SuccessResponse{data=storage.Comment}
|
|
// @Failure 400 {object} models.ErrorResponse "Invalid ID format"
|
|
// @Failure 404 {object} models.ErrorResponse "Comment not found"
|
|
// @Failure 500 {object} models.ErrorResponse "Internal server error"
|
|
// @Router admin/comments/{id} [delete]
|
|
func (h *CommentsHandlers) DeleteComment(c *gin.Context) {
|
|
}
|