Documentation ¶
Index ¶
- Variables
- type Controller
- func (c *Controller) Delete(w http.ResponseWriter, r *http.Request)
- func (c *Controller) Get(w http.ResponseWriter, r *http.Request)
- func (c *Controller) GetChildren(w http.ResponseWriter, r *http.Request)
- func (c *Controller) GetLineage(w http.ResponseWriter, r *http.Request)
- func (c *Controller) GetLineageSiblings(w http.ResponseWriter, r *http.Request)
- func (c *Controller) GetMembers(w http.ResponseWriter, r *http.Request)
- func (c *Controller) GetOfficers(w http.ResponseWriter, r *http.Request)
- func (c *Controller) Patch(w http.ResponseWriter, r *http.Request)
- func (c *Controller) Post(w http.ResponseWriter, r *http.Request)
- type DeleteResponseDto
- type Entity
- type GetChildrenResponseDto
- type GetLineageResponseDto
- type GetLineagelSiblingsResponseDto
- type GetMembersResponseDto
- type GetOfficersResponseDto
- type GetResponseDto
- type PatchRequestDto
- type PatchResponseDto
- type PostRequestDto
- type PostResponseDto
- type Query
- type QueryImpl
- func (q *QueryImpl) SelectById(fields []string, id string) *gorm.DB
- func (q *QueryImpl) SelectChildrenByHierarchy(fields []string, hierarchy string) *gorm.DB
- func (q *QueryImpl) SelectChildrenById(fields []string, id string) *gorm.DB
- func (q *QueryImpl) SelectLineageByHierarchy(fields []string, hierarchy string) (*gorm.DB, error)
- func (q *QueryImpl) SelectLineageSiblingsByHierarchy(fields []string, hierarchy string) (*gorm.DB, error)
- type Repository
- type RepositoryImpl
- func (r *RepositoryImpl) Create(req *Entity) (*Entity, error)
- func (r *RepositoryImpl) DeleteById(id string) error
- func (r *RepositoryImpl) FindById(id string) (*Entity, error)
- func (r *RepositoryImpl) FindChildrenByHierarchy(hierarchy string) ([]Entity, error)
- func (r *RepositoryImpl) FindChildrenById(id string) ([]Entity, error)
- func (r *RepositoryImpl) FindLineageByHierarchy(hierarchy string) ([]Entity, error)
- func (r *RepositoryImpl) FindLineageById(id string) ([]Entity, error)
- func (r *RepositoryImpl) FindLineageSiblingsByHierarchy(hierarchy string) ([]Entity, error)
- func (r *RepositoryImpl) FindLineageSiblingsById(id string) ([]Entity, error)
- func (r *RepositoryImpl) UpdateById(fields map[string]interface{}, id string) error
- type Service
- func (s *Service) Create(req PostRequestDto) (*Entity, error)
- func (s *Service) DeleteById(id string) error
- func (s *Service) RetrieveById(id string) (*Entity, error)
- func (s *Service) RetrieveChildrenById(id string) ([]Entity, error)
- func (s *Service) RetrieveLineageById(id string) (*tree.Node[Entity], error)
- func (s *Service) RetrieveLineageSiblingsById(id string) (*tree.Node[Entity], error)
- func (s *Service) UpdateById(fields map[string]interface{}, id string) error
Constants ¶
This section is empty.
Variables ¶
var ( FieldsAll = []string{ "id", "hierarchy", "name", "email_address", } FieldsAllExceptId = []string{ "hierarchy", "name", "email_address", } FieldsHierarchy = []string{ "hierarchy", } FieldsPatchable = []string{ "hierarchy", "name", "email_address", } )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct { ConfigService *config.Service LocalErrorService *localerror.Service NodeService *Service DesignationService *designation.Service MembershipService *membership.Service }
func NewController ¶
func NewController( cfg *config.Service, les *localerror.Service, svc *Service, ds *designation.Service, ms *membership.Service, ) *Controller
func (*Controller) Delete ¶
func (c *Controller) Delete(w http.ResponseWriter, r *http.Request)
Delete Nodes : HTTP endpoint to delete nodes @Tags Nodes @Description Delete a node @Produce json @Param id path string true "Node ID" @Success 200 {object} DeleteResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /nodes/{id} [DELETE]
func (*Controller) Get ¶
func (c *Controller) Get(w http.ResponseWriter, r *http.Request)
Get Nodes : HTTP endpoint to get a node @Tags Nodes @Description Get a node @Produce json @Param id path string true "Node ID" @Success 200 {object} GetResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /nodes/{id} [GET]
func (*Controller) GetChildren ¶
func (c *Controller) GetChildren(w http.ResponseWriter, r *http.Request)
Get Children of Nodes : HTTP endpoint to get the children of a node @Tags Nodes @Description Get children of a node @Produce json @Param id path string true "Node ID" @Success 200 {object} GetChildrenResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /nodes/{id}/children [GET]
func (*Controller) GetLineage ¶
func (c *Controller) GetLineage(w http.ResponseWriter, r *http.Request)
Get Lineage of Nodes : HTTP endpoint to get the lineage of a node @Tags Nodes @Description Get lineage of a node @Produce json @Param id path string true "Node ID" @Success 200 {object} GetLineageResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /nodes/{id}/lineage [GET]
func (*Controller) GetLineageSiblings ¶
func (c *Controller) GetLineageSiblings(w http.ResponseWriter, r *http.Request)
Get Lineage Siblings of Nodes : HTTP endpoint to get the siblings and ancestral siblings of a node @Tags Nodes @Description Get siblings and ancestral siblings of a node @Produce json @Param id path string true "Node ID" @Success 200 {object} GetLineagelSiblingsResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /nodes/{id}/lineage-siblings [GET]
func (*Controller) GetMembers ¶
func (c *Controller) GetMembers(w http.ResponseWriter, r *http.Request)
Get Members within Nodes : HTTP endpoint to get the current members within a node @Tags Nodes @Description Get current members within a node @Produce json @Param id path string true "Node ID" @Success 200 {object} GetMembersResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /nodes/{id}/members [GET]
func (*Controller) GetOfficers ¶
func (c *Controller) GetOfficers(w http.ResponseWriter, r *http.Request)
Get Officers within Nodes : HTTP endpoint to get the officers within a node @Tags Nodes @Description Get officers within a node @Produce json @Param id path string true "Node ID" @Success 200 {object} GetOfficersResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /nodes/{id}/officers [GET]
func (*Controller) Patch ¶
func (c *Controller) Patch(w http.ResponseWriter, r *http.Request)
Patch Nodes : HTTP endpoint to patch a node @Tags Nodes @Description Patch a node @Accept json @Produce json @Param id path string true "Node ID" @Param data body PatchRequestDto true "Node Patch Request" @Success 200 {object} PatchResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /nodes/{id} [PATCH]
func (*Controller) Post ¶
func (c *Controller) Post(w http.ResponseWriter, r *http.Request)
Post Nodes : HTTP endpoint to post new nodes @Tags Nodes @Description Post a new node @Accept json @Produce json @Param data body PostRequestDto true "Node Request" @Success 200 {object} PostResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /nodes [POST]
type DeleteResponseDto ¶
type DeleteResponseDto = dtorespwithoutdata.Class
type Entity ¶
type GetChildrenResponseDto ¶
type GetChildrenResponseDto = dtorespwithdata.Class[[]Entity]
type GetLineageResponseDto ¶
type GetLineageResponseDto = dtorespwithdata.Class[tree.Node[Entity]]
type GetLineagelSiblingsResponseDto ¶
type GetLineagelSiblingsResponseDto = dtorespwithdata.Class[tree.Node[Entity]]
type GetMembersResponseDto ¶
type GetMembersResponseDto = dtorespwithdata.Class[[]membership.ViewEntity]
type GetOfficersResponseDto ¶
type GetOfficersResponseDto = dtorespwithdata.Class[[]designation.Entity]
type GetResponseDto ¶
type GetResponseDto = dtorespwithdata.Class[Entity]
type PatchRequestDto ¶
type PatchRequestDto struct {
Fields map[string]interface{} `json:"fields"`
}
type PatchResponseDto ¶
type PatchResponseDto = dtorespwithoutdata.Class
type PostRequestDto ¶
type PostResponseDto ¶
type PostResponseDto = dtorespwithdata.Class[Entity]
type Query ¶
type Query interface { SelectById(fields []string, id string) *gorm.DB SelectChildrenByHierarchy(fields []string, hierarchy string) *gorm.DB SelectLineageByHierarchy(fields []string, hierarchy string) (*gorm.DB, error) SelectLineageSiblingsByHierarchy(fields []string, hierarchy string) (*gorm.DB, error) SelectChildrenById(fields []string, id string) *gorm.DB }
type QueryImpl ¶
func (*QueryImpl) SelectChildrenByHierarchy ¶
func (*QueryImpl) SelectChildrenById ¶
func (*QueryImpl) SelectLineageByHierarchy ¶
type Repository ¶
type Repository interface { Create(req *Entity) (*Entity, error) UpdateById(fields map[string]interface{}, id string) error FindById(id string) (*Entity, error) DeleteById(id string) error FindChildrenByHierarchy(hierarchy string) ([]Entity, error) FindLineageByHierarchy(hierarchy string) ([]Entity, error) FindLineageSiblingsByHierarchy(hierarchy string) ([]Entity, error) FindChildrenById(id string) ([]Entity, error) FindLineageById(hierarchy string) ([]Entity, error) FindLineageSiblingsById(hierarchy string) ([]Entity, error) }
func NewRepository ¶
func NewRepository(cfg *config.Service) Repository
type RepositoryImpl ¶
func (*RepositoryImpl) DeleteById ¶
func (r *RepositoryImpl) DeleteById(id string) error
func (*RepositoryImpl) FindChildrenByHierarchy ¶
func (r *RepositoryImpl) FindChildrenByHierarchy(hierarchy string) ([]Entity, error)
func (*RepositoryImpl) FindChildrenById ¶
func (r *RepositoryImpl) FindChildrenById(id string) ([]Entity, error)
func (*RepositoryImpl) FindLineageByHierarchy ¶
func (r *RepositoryImpl) FindLineageByHierarchy(hierarchy string) ([]Entity, error)
func (*RepositoryImpl) FindLineageById ¶
func (r *RepositoryImpl) FindLineageById(id string) ([]Entity, error)
func (*RepositoryImpl) FindLineageSiblingsByHierarchy ¶
func (r *RepositoryImpl) FindLineageSiblingsByHierarchy( hierarchy string, ) ([]Entity, error)
func (*RepositoryImpl) FindLineageSiblingsById ¶
func (r *RepositoryImpl) FindLineageSiblingsById(id string) ([]Entity, error)
func (*RepositoryImpl) UpdateById ¶
func (r *RepositoryImpl) UpdateById(fields map[string]interface{}, id string) error
type Service ¶
type Service struct { ConfigService *config.Service NodeRepository Repository }
func NewService ¶
func NewService( cfg *config.Service, r Repository, ) *Service