Documentation ¶
Index ¶
- type CommentService
- type Handler
- func (h *Handler) ArchivePost(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateComment(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeletePost(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetCommentsPost(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetEntireThing(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetPost(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Routes() []router.Route
- func (h *Handler) UpdatePost(w http.ResponseWriter, r *http.Request)
- type MongoDBRepository
- func (r *MongoDBRepository) ChangeStatus(ctx context.Context, id string, status types.Status) error
- func (r *MongoDBRepository) CheckPostBelongTo(ctx context.Context, idCom string, idPost string) (*types.Post, error)
- func (r *MongoDBRepository) Create(ctx context.Context, req *types.Post) error
- func (r *MongoDBRepository) FindByID(ctx context.Context, idPost string) (*types.Post, error)
- func (r *MongoDBRepository) GetAllPost(ctx context.Context, idCom string) ([]*types.Post, error)
- func (r *MongoDBRepository) GetEntire(ctx context.Context) ([]*types.Post, error)
- func (r *MongoDBRepository) UpdatePost(ctx context.Context, id string, p *types.PostUpdateRequest) error
- type PolicyService
- type RepoProvider
- type Service
- func (s *Service) ChangeStatus(ctx context.Context, idPost string, stat types.Status) error
- func (s *Service) CheckPostBelongTo(ctx context.Context, idCom string, idPost string) (*types.Post, error)
- func (s *Service) Create(ctx context.Context, req *types.Post, idCom string) (*types.Post, error)
- func (s *Service) CreateComment(ctx context.Context, req *types.Comment, idPost string) (*types.Comment, error)
- func (s *Service) FindByID(ctx context.Context, idPost string) (*types.Post, error)
- func (s *Service) GetAll(ctx context.Context, idCom string) ([]*types.Post, error)
- func (s *Service) GetCommentsPost(ctx context.Context, idPost string) ([]*types.Comment, error)
- func (s *Service) GetEntire(ctx context.Context) ([]*types.Post, error)
- func (s *Service) UpdatePost(ctx context.Context, idPost string, p *types.PostUpdateRequest) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommentService ¶
type Handler ¶
type Handler struct {
Svc service
}
func NewHandler ¶
func NewHandler(svc service) *Handler
func (*Handler) ArchivePost ¶
func (h *Handler) ArchivePost(w http.ResponseWriter, r *http.Request)
ArchivePost post can no longer be edited or commented
func (*Handler) CreateComment ¶
func (h *Handler) CreateComment(w http.ResponseWriter, r *http.Request)
func (*Handler) DeletePost ¶
func (h *Handler) DeletePost(w http.ResponseWriter, r *http.Request)
func (*Handler) GetCommentsPost ¶
func (h *Handler) GetCommentsPost(w http.ResponseWriter, r *http.Request)
func (*Handler) GetEntireThing ¶
func (h *Handler) GetEntireThing(w http.ResponseWriter, r *http.Request)
GetEntireThing get all post to display in homepage
func (*Handler) UpdatePost ¶
func (h *Handler) UpdatePost(w http.ResponseWriter, r *http.Request)
type MongoDBRepository ¶
type MongoDBRepository struct {
// contains filtered or unexported fields
}
func NewMongoDBRepo ¶
func NewMongoDBRepo(session *mgo.Session) *MongoDBRepository
func (*MongoDBRepository) ChangeStatus ¶
func (*MongoDBRepository) CheckPostBelongTo ¶
func (*MongoDBRepository) GetAllPost ¶
func (*MongoDBRepository) UpdatePost ¶
func (r *MongoDBRepository) UpdatePost(ctx context.Context, id string, p *types.PostUpdateRequest) error
type PolicyService ¶
type RepoProvider ¶
type RepoProvider interface { Create(ctx context.Context, req *types.Post) error GetAllPost(ctx context.Context, idCom string) ([]*types.Post, error) CheckPostBelongTo(ctx context.Context, idCom string, idPost string) (*types.Post, error) FindByID(ctx context.Context, idPost string) (*types.Post, error) UpdatePost(ctx context.Context, id string, p *types.PostUpdateRequest) error ChangeStatus(ctx context.Context, id string, status types.Status) error GetEntire(ctx context.Context) ([]*types.Post, error) }
type Service ¶
type Service struct { Repo RepoProvider // contains filtered or unexported fields }
func NewService ¶
func NewService(repo RepoProvider, policy PolicyService, cmtService CommentService) *Service
func (*Service) ChangeStatus ¶
func (*Service) CheckPostBelongTo ¶
func (*Service) CreateComment ¶
func (s *Service) CreateComment(ctx context.Context, req *types.Comment, idPost string) (*types.Comment, error)
Comments
func (*Service) GetCommentsPost ¶
func (*Service) UpdatePost ¶
Click to show internal directories.
Click to hide internal directories.