community

package
v0.0.0-...-dd01cb3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Svc service
}

func NewHandler

func NewHandler(svc service) *Handler

func (*Handler) CreateCommunity

func (h *Handler) CreateCommunity(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteCom

func (h *Handler) DeleteCom(w http.ResponseWriter, r *http.Request)

func (*Handler) EnrollUser

func (h *Handler) EnrollUser(w http.ResponseWriter, r *http.Request)

func (*Handler) GetAllCommunity

func (h *Handler) GetAllCommunity(w http.ResponseWriter, r *http.Request)

func (*Handler) GetAllMods

func (h *Handler) GetAllMods(w http.ResponseWriter, r *http.Request)

func (*Handler) GetAllPosts

func (h *Handler) GetAllPosts(w http.ResponseWriter, r *http.Request)

func (*Handler) GetCommunity

func (h *Handler) GetCommunity(w http.ResponseWriter, r *http.Request)

func (*Handler) GetUsers

func (h *Handler) GetUsers(w http.ResponseWriter, r *http.Request)

func (*Handler) PromoteMod

func (h *Handler) PromoteMod(w http.ResponseWriter, r *http.Request)

func (*Handler) Routes

func (h *Handler) Routes() []router.Route

func (*Handler) SubmitPost

func (h *Handler) SubmitPost(w http.ResponseWriter, r *http.Request)

func (*Handler) TransferAdmin

func (h *Handler) TransferAdmin(w http.ResponseWriter, r *http.Request)

func (*Handler) UpdateInfo

func (h *Handler) UpdateInfo(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 (r *MongoDBRepository) ChangeStatus(ctx context.Context, id string, status types.CommunityStatus) error

func (*MongoDBRepository) Create

func (r *MongoDBRepository) Create(ctx context.Context, com *types.Community) error

func (*MongoDBRepository) Delete

func (r *MongoDBRepository) Delete(ctx context.Context) error

func (*MongoDBRepository) FindAllCom

func (r *MongoDBRepository) FindAllCom(context.Context) ([]*types.Community, error)

func (*MongoDBRepository) FindCommunityByID

func (r *MongoDBRepository) FindCommunityByID(ctx context.Context, cID string) (*types.Community, error)

func (*MongoDBRepository) FindCommunityByName

func (r *MongoDBRepository) FindCommunityByName(ctx context.Context, cName string) (*types.Community, error)

func (*MongoDBRepository) UpdateInfo

func (r *MongoDBRepository) UpdateInfo(ctx context.Context, idCom string, comm *types.Community) error

type NotifiService

type NotifiService interface {
	CreateNotificaion(ctx context.Context, postID string, userIDs []string, mess string) error
}

type PolicyService

type PolicyService interface {
	AddPolicy(ctx context.Context, req types.Policy) error
	Validate(ctx context.Context, obj string, act string) error
	GetAllMods(ctx context.Context, id string) ([]string, error)
	RemovePolicy(ctx context.Context, idOwner, idCom string) error
}

type PostService

type PostService interface {
	Create(ctx context.Context, req *types.Post, idCom string) (*types.Post, error)
	GetAll(ctx context.Context, idCom string) ([]*types.Post, error)
}

type RepoProvider

type RepoProvider interface {
	Create(ctx context.Context, com *types.Community) error
	FindCommunityByID(ctx context.Context, cID string) (*types.Community, error)
	FindAllCom(context.Context) ([]*types.Community, error)
	FindCommunityByName(ctx context.Context, cName string) (*types.Community, error)
	ChangeStatus(ctx context.Context, id string, status types.CommunityStatus) error
	UpdateInfo(ctx context.Context, idCom string, comm *types.Community) error
}

type Service

type Service struct {
	Repo RepoProvider
	// contains filtered or unexported fields
}

func NewService

func NewService(repo RepoProvider, policySvc PolicyService, postSvc PostService, userSvc UserService, notiSvc NotifiService) *Service

func (*Service) CreateCommunity

func (s *Service) CreateCommunity(ctx context.Context, cm *types.Community) (*types.Community, error)

func (*Service) EnrollUser

func (s *Service) EnrollUser(ctx context.Context, idCom string) error

func (*Service) FindAllUserID

func (s *Service) FindAllUserID(ctx context.Context, idCom string) ([]string, error)

func (*Service) GetAll

func (s *Service) GetAll(ctx context.Context) ([]*types.Community, error)

func (*Service) GetAllMods

func (s *Service) GetAllMods(ctx context.Context, idCom string) ([]*types.User, error)

------------------------------------------------------------------------------------------------> HERE!!!!!!!!!!!!!!!!!!

func (*Service) GetAllPosts

func (s *Service) GetAllPosts(ctx context.Context, nameComm string) ([]*types.Post, error)

func (*Service) GetCommunity

func (s *Service) GetCommunity(ctx context.Context, name string) (*types.Community, error)

func (*Service) GetUsers

func (s *Service) GetUsers(ctx context.Context, idCom string) ([]*types.User, error)

func (*Service) PrivateCommunity

func (s *Service) PrivateCommunity(ctx context.Context, Com string) error

func (*Service) PromoteUser

func (s *Service) PromoteUser(ctx context.Context, idUser string, idCom string) error

func (*Service) SearchCommunity

func (s *Service) SearchCommunity(ctx context.Context, name string) (*types.Community, error)

func (*Service) SubmitPost

func (s *Service) SubmitPost(ctx context.Context, nameComm string, req *types.Post) (*types.Post, error)

func (*Service) TransferAdmin

func (s *Service) TransferAdmin(ctx context.Context, idUser, nameCom string) error

func (*Service) UpdateInfo

func (s *Service) UpdateInfo(ctx context.Context, idCom string, comm *types.Community) error

------------------------------------------------------------------------------------------------> HERE!!!!!!!!!!!!!!!!!!

type UserIDPolicyRequest

type UserIDPolicyRequest struct {
	ID string `json:"id"`
}

type UserService

type UserService interface {
	EnrollUser(ctx context.Context, idCom, idUser string) error
	CheckUserEnrolled(ctx context.Context, idUser string, idCom string) (string, error)
	GetUsersCommunity(ctx context.Context, idCom string) ([]*types.User, error)
	GetMods(ctx context.Context, listID []string) ([]*types.User, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL