service

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrganizationConfigRepository

type OrganizationConfigRepository interface {
	GetByOrganizationID(ctx context.Context, organizationID string) (*entity.OrganizationConfig, error)
	Create(ctx context.Context, config *entity.OrganizationConfig) error
	Update(ctx context.Context, config *entity.OrganizationConfig) error
	Delete(ctx context.Context, organizationID string) error
	List(ctx context.Context, limit, offset int) ([]*entity.OrganizationConfig, error)
}

OrganizationConfigRepository interface for persistence

type ServiceRegistry

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

ServiceRegistry manages which services are enabled for each organization

func NewServiceRegistry

func NewServiceRegistry(configRepo OrganizationConfigRepository, logger *logrus.Logger) *ServiceRegistry

NewServiceRegistry creates a new service registry

func (*ServiceRegistry) CalculateMonthlyPrice

func (sr *ServiceRegistry) CalculateMonthlyPrice(ctx context.Context, organizationID string) (float64, error)

CalculateMonthlyPrice calculates the monthly price for an organization

func (*ServiceRegistry) ClearCache

func (sr *ServiceRegistry) ClearCache()

ClearCache clears the internal cache

func (*ServiceRegistry) CreateOrganizationConfig

func (sr *ServiceRegistry) CreateOrganizationConfig(ctx context.Context, organizationID string, templateType entity.TemplateType) (*entity.OrganizationConfig, error)

CreateOrganizationConfig creates a new organization configuration

func (*ServiceRegistry) DeleteOrganizationConfig

func (sr *ServiceRegistry) DeleteOrganizationConfig(ctx context.Context, organizationID string) error

DeleteOrganizationConfig deletes an organization configuration

func (*ServiceRegistry) DisableService

func (sr *ServiceRegistry) DisableService(ctx context.Context, organizationID, serviceName string) error

DisableService disables a service for an organization

func (*ServiceRegistry) EnableService

func (sr *ServiceRegistry) EnableService(ctx context.Context, organizationID, serviceName string) error

EnableService enables a service for an organization

func (*ServiceRegistry) GetAvailableTemplates

func (sr *ServiceRegistry) GetAvailableTemplates() []TemplateInfo

GetAvailableTemplates returns all available organization templates

func (*ServiceRegistry) GetEnabledServices

func (sr *ServiceRegistry) GetEnabledServices(ctx context.Context, organizationID string) ([]string, error)

GetEnabledServices returns all enabled services for an organization

func (*ServiceRegistry) GetOrganizationConfig

func (sr *ServiceRegistry) GetOrganizationConfig(ctx context.Context, organizationID string) (*entity.OrganizationConfig, error)

GetOrganizationConfig returns the configuration for an organization

func (*ServiceRegistry) IsServiceEnabled

func (sr *ServiceRegistry) IsServiceEnabled(ctx context.Context, organizationID, serviceName string) (bool, error)

IsServiceEnabled checks if a service is enabled for an organization

func (*ServiceRegistry) ListOrganizationConfigs

func (sr *ServiceRegistry) ListOrganizationConfigs(ctx context.Context, limit, offset int) ([]*entity.OrganizationConfig, error)

ListOrganizationConfigs returns a paginated list of organization configurations

func (*ServiceRegistry) UpdateOrganizationConfig

func (sr *ServiceRegistry) UpdateOrganizationConfig(ctx context.Context, config *entity.OrganizationConfig) error

UpdateOrganizationConfig updates an organization configuration

type ServiceRegistryInterface added in v1.0.1

type ServiceRegistryInterface interface {
	GetOrganizationConfig(ctx context.Context, organizationID string) (*entity.OrganizationConfig, error)
	CreateOrganizationConfig(ctx context.Context, organizationID string, templateType entity.TemplateType) (*entity.OrganizationConfig, error)
	UpdateOrganizationConfig(ctx context.Context, config *entity.OrganizationConfig) error
	EnableService(ctx context.Context, organizationID, serviceName string) error
	DisableService(ctx context.Context, organizationID, serviceName string) error
	GetAvailableTemplates() []TemplateInfo
}

ServiceRegistryInterface defines the contract for service registry operations

type TemplateInfo

type TemplateInfo struct {
	Type        entity.TemplateType `json:"type"`
	Name        string              `json:"name"`
	Description string              `json:"description"`
	Features    []string            `json:"features"`
	Price       float64             `json:"price"`
}

TemplateInfo contains information about an organization template

Jump to

Keyboard shortcuts

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