Documentation
¶
Index ¶
- type ContentCommentService
- func (s *ContentCommentService) CreateContentComment(data *models.ContentCommentModel) error
- func (s *ContentCommentService) DeleteContentComment(id string) error
- func (s *ContentCommentService) GetContentCommentByID(id string) (*models.ContentCommentModel, error)
- func (s *ContentCommentService) GetContentComments(request http.Request, search string) (paginate.Page, error)
- func (s *ContentCommentService) UpdateContentComment(id string, data *models.ContentCommentModel) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentCommentService ¶
type ContentCommentService struct {
// contains filtered or unexported fields
}
func NewContentCommentService ¶
func NewContentCommentService(db *gorm.DB, ctx *context.ERPContext) *ContentCommentService
func (*ContentCommentService) CreateContentComment ¶
func (s *ContentCommentService) CreateContentComment(data *models.ContentCommentModel) error
CreateContentComment creates a new content comment.
The function takes a pointer to a ContentCommentModel instance, which contains the data to be inserted into the database. It returns an error if the insertion fails.
func (*ContentCommentService) DeleteContentComment ¶
func (s *ContentCommentService) DeleteContentComment(id string) error
DeleteContentComment deletes a content comment.
It takes a string id as a parameter and deletes a record in the content_comments table with the given id. It returns an error if the deletion fails.
func (*ContentCommentService) GetContentCommentByID ¶
func (s *ContentCommentService) GetContentCommentByID(id string) (*models.ContentCommentModel, error)
func (*ContentCommentService) GetContentComments ¶
func (s *ContentCommentService) GetContentComments(request http.Request, search string) (paginate.Page, error)
GetContentComments retrieves a paginated list of content comments from the database.
It takes an HTTP request and a search query string as parameters. The search query is applied to the content comment's comment field. If a company ID is present in the request header, the result is filtered by the company ID. The function uses pagination to manage the result set and includes any necessary request modifications using the utils.FixRequest utility.
The function returns a paginated page of ContentCommentModel and an error if the operation fails.
func (*ContentCommentService) UpdateContentComment ¶
func (s *ContentCommentService) UpdateContentComment(id string, data *models.ContentCommentModel) error
UpdateContentComment updates an existing content comment.
It takes a string id and a pointer to a ContentCommentModel as parameters and returns an error. It uses the gorm.DB connection to update a record in the content_comments table.