organization

package
v0.0.0-...-77e2b90 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDomainContextMissing = errors.New("ou organization: missing domain context")
	ErrInvalidDomainID      = errors.New("ou organization: invalid domain id")
	ErrOrganizationNotFound = errors.New("ou organization: organization not found")
	ErrMemberAlreadyExists  = errors.New("ou organization: member already exists")
)

Functions

This section is empty.

Types

type AddOrganizationMemberRequest

type AddOrganizationMemberRequest struct {
	UserID    uuid.UUID `json:"userId" binding:"required"`
	IsPrimary bool      `json:"isPrimary"`
}

type CreateOrganizationRequest

type CreateOrganizationRequest struct {
	Code     string     `json:"code" binding:"required"`
	Name     string     `json:"name" binding:"required"`
	ParentID *uuid.UUID `json:"parentId,omitempty"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(service *Service, logger logging.Logger) *Handler

func (*Handler) AddOrganizationMember

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

AddOrganizationMember handles POST /ou/organizations/{id}/members

@Summary Add organization member @Tags OUPlugin-Organizations @Accept json @Produce json @Param id path string true "Organization ID" @Param body body AddOrganizationMemberRequest true "Organization member payload" @Success 200 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 404 {object} map[string]interface{} @Failure 409 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /api/v1/ou/organizations/{id}/members [post]

func (*Handler) CreateOrganization

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

CreateOrganization handles POST /ou/organizations

@Summary Create organization @Tags OUPlugin-Organizations @Accept json @Produce json @Param body body CreateOrganizationRequest true "Organization payload" @Success 200 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 404 {object} map[string]interface{} @Failure 409 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /api/v1/ou/organizations [post]

func (*Handler) GetOrganizationTree

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

GetOrganizationTree handles GET /ou/organizations/tree

@Summary Get organization tree @Tags OUPlugin-Organizations @Produce json @Success 200 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /api/v1/ou/organizations/tree [get]

type OrganizationMemberResponse

type OrganizationMemberResponse struct {
	ID             uuid.UUID `json:"id"`
	OrganizationID uuid.UUID `json:"organizationId"`
	UserID         uuid.UUID `json:"userId"`
	IsPrimary      bool      `json:"isPrimary"`
}

type OrganizationResponse

type OrganizationResponse struct {
	ID       uuid.UUID  `json:"id"`
	DomainID uuid.UUID  `json:"domainId"`
	ParentID *uuid.UUID `json:"parentId,omitempty"`
	Code     string     `json:"code"`
	Name     string     `json:"name"`
	Path     string     `json:"path"`
}

type OrganizationTreeNode

type OrganizationTreeNode struct {
	ID       uuid.UUID               `json:"id"`
	DomainID uuid.UUID               `json:"domainId"`
	ParentID *uuid.UUID              `json:"parentId,omitempty"`
	Code     string                  `json:"code"`
	Name     string                  `json:"name"`
	Path     string                  `json:"path"`
	Children []*OrganizationTreeNode `json:"children,omitempty"`
}

type Service

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

func NewService

func NewService(client *ent.Client) *Service

func (*Service) AddOrganizationMember

func (s *Service) AddOrganizationMember(
	ctx context.Context,
	organizationID uuid.UUID,
	req *AddOrganizationMemberRequest,
) (*OrganizationMemberResponse, error)

func (*Service) CreateOrganization

func (s *Service) CreateOrganization(ctx context.Context, req *CreateOrganizationRequest) (*OrganizationResponse, error)

func (*Service) GetOrganizationTree

func (s *Service) GetOrganizationTree(ctx context.Context) ([]*OrganizationTreeNode, error)

func (*Service) GetPrimaryOrganizationID

func (s *Service) GetPrimaryOrganizationID(ctx context.Context, domainID, userID uuid.UUID) (uuid.UUID, error)

func (*Service) ListOrganizationUserIDs

func (s *Service) ListOrganizationUserIDs(ctx context.Context, domainID, orgID uuid.UUID) ([]uuid.UUID, error)

func (*Service) ListSubtreeUserIDs

func (s *Service) ListSubtreeUserIDs(ctx context.Context, domainID, orgID uuid.UUID) ([]uuid.UUID, error)

Jump to

Keyboard shortcuts

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