Documentation
¶
Index ¶
- Variables
- type CommentHandler
- type CommentHandlerImpl
- func (h *CommentHandlerImpl) CreateComments(c *fiber.Ctx) error
- func (h *CommentHandlerImpl) DeleteComment(c *fiber.Ctx) error
- func (h *CommentHandlerImpl) GetAllCommentsPost(c *fiber.Ctx) error
- func (h *CommentHandlerImpl) GetMyComment(c *fiber.Ctx) error
- func (h *CommentHandlerImpl) GetUserComments(c *fiber.Ctx) error
- func (h *CommentHandlerImpl) UpdateComment(c *fiber.Ctx) error
- type CommentRepository
- type CommentRepositoryImpl
- func (r *CommentRepositoryImpl) CreateCommentByPostID(comment *models.Comment) error
- func (r *CommentRepositoryImpl) DeleteCommentByCommentAndPostID(comment *models.Comment) error
- func (r *CommentRepositoryImpl) FindCommentsByPostID(comment *models.Comment) ([]models.Comment, error)
- func (r *CommentRepositoryImpl) UpdateCommentByCommentAndPostID(comment *models.Comment) error
- type CommentService
- type CommentServiceImpl
- func (s *CommentServiceImpl) CreateCommentByPostID(postID, authorID uint, comment *CreateCommentRequest) error
- func (s *CommentServiceImpl) DeleteComment(commentID, PostID, userID uint) error
- func (s *CommentServiceImpl) GetCommentsByPostID(postID, userID uint) (*GetCommentsResponse, error)
- func (s *CommentServiceImpl) UpdateComment(commentID, postID, userID uint, fields *UpdateCommentRequest) error
- type CreateCommentRequest
- type GetCommentResponseBody
- type GetCommentsResponse
- type UpdateCommentRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPermissionDenied = errors.New("permission denied")
Functions ¶
This section is empty.
Types ¶
type CommentHandler ¶
type CommentHandlerImpl ¶
type CommentHandlerImpl struct { CommentService CommentService // contains filtered or unexported fields }
func NewCommentHandler ¶
func NewCommentHandler(commentService CommentService, validator *validate.XValidator) *CommentHandlerImpl
func (*CommentHandlerImpl) CreateComments ¶
func (h *CommentHandlerImpl) CreateComments(c *fiber.Ctx) error
func (*CommentHandlerImpl) DeleteComment ¶
func (h *CommentHandlerImpl) DeleteComment(c *fiber.Ctx) error
func (*CommentHandlerImpl) GetAllCommentsPost ¶
func (h *CommentHandlerImpl) GetAllCommentsPost(c *fiber.Ctx) error
func (*CommentHandlerImpl) GetMyComment ¶
func (h *CommentHandlerImpl) GetMyComment(c *fiber.Ctx) error
func (*CommentHandlerImpl) GetUserComments ¶
func (h *CommentHandlerImpl) GetUserComments(c *fiber.Ctx) error
func (*CommentHandlerImpl) UpdateComment ¶
func (h *CommentHandlerImpl) UpdateComment(c *fiber.Ctx) error
type CommentRepository ¶
type CommentRepositoryImpl ¶
type CommentRepositoryImpl struct {
// contains filtered or unexported fields
}
func NewCommentRepository ¶
func NewCommentRepository(db *gorm.DB) *CommentRepositoryImpl
func (*CommentRepositoryImpl) CreateCommentByPostID ¶
func (r *CommentRepositoryImpl) CreateCommentByPostID(comment *models.Comment) error
func (*CommentRepositoryImpl) DeleteCommentByCommentAndPostID ¶
func (r *CommentRepositoryImpl) DeleteCommentByCommentAndPostID(comment *models.Comment) error
func (*CommentRepositoryImpl) FindCommentsByPostID ¶
func (*CommentRepositoryImpl) UpdateCommentByCommentAndPostID ¶
func (r *CommentRepositoryImpl) UpdateCommentByCommentAndPostID(comment *models.Comment) error
type CommentService ¶
type CommentService interface { GetCommentsByPostID(postID, userID uint) (*GetCommentsResponse, error) CreateCommentByPostID(postID, authorID uint, comment *CreateCommentRequest) error UpdateComment(commentID, PostID, userID uint, updatedFields *UpdateCommentRequest) error DeleteComment(commentID, PostID, userID uint) error }
type CommentServiceImpl ¶
type CommentServiceImpl struct { CommentRepo CommentRepository PostRepo post.PostRepository }
func NewCommentService ¶
func NewCommentService(commentRepo CommentRepository, postRepo post.PostRepository) *CommentServiceImpl
func (*CommentServiceImpl) CreateCommentByPostID ¶
func (s *CommentServiceImpl) CreateCommentByPostID(postID, authorID uint, comment *CreateCommentRequest) error
func (*CommentServiceImpl) DeleteComment ¶
func (s *CommentServiceImpl) DeleteComment(commentID, PostID, userID uint) error
func (*CommentServiceImpl) GetCommentsByPostID ¶
func (s *CommentServiceImpl) GetCommentsByPostID(postID, userID uint) (*GetCommentsResponse, error)
func (*CommentServiceImpl) UpdateComment ¶
func (s *CommentServiceImpl) UpdateComment(commentID, postID, userID uint, fields *UpdateCommentRequest) error
type CreateCommentRequest ¶
type GetCommentResponseBody ¶
type GetCommentsResponse ¶
type GetCommentsResponse struct {
Comments []GetCommentResponseBody `json:"comments"`
}
type UpdateCommentRequest ¶
type UpdateCommentRequest struct {
Content string `json:"content" validate:"required,max=255"`
}
Click to show internal directories.
Click to hide internal directories.