orgsvc

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOrganizationNotFound = organizations.ErrNotFound
	ErrSlugAlreadyExists    = organizations.ErrSlugAlreadyExists
)

Re-exported from repository layer — single source of truth.

View Source
var (
	ErrInvalidUserSlug = xerror.InvalidInput(xerror.User)
	ErrInvalidOrgSlug  = xerror.InvalidInput(xerror.Organization)
	ErrDeletionBlocked = xerror.New(xerror.KindAlreadyExists, "ORGANIZATION_DELETION_BLOCKED", "remove projects and data sources, resolve outstanding processing, and wait for Snowflake workload identity cleanup to complete before retrying organization deletion")
)

Service-only errors.

Functions

This section is empty.

Types

type DefaultEnvironmentsService

type DefaultEnvironmentsService interface {
	CreateDefaultEnvironments(ctx context.Context, orgSlug slug.Slug) error
}

type Option

type Option func(*service)

func WithBeforeDelete

func WithBeforeDelete(beforeDelete func(context.Context, postgres.DBTX, slug.Slug) error) Option

type Service

type Service interface {
	DeleteOrganization(ctx context.Context, orgSlug slug.Slug) error
	CreateOrganization(
		ctx context.Context,
		userSlug slug.Slug,
		actor model.EventActor,
		newOrg model.NewOrganization,
	) (*model.Organization, error)
	ListOrganizations(
		ctx context.Context,
		userSlug slug.Slug,
		req model.ListRequest,
	) (model.ListResponse[model.OrganizationWithRole], error)
	GetOrganization(ctx context.Context, orgSlug slug.Slug) (*model.Organization, error)
	GetRetentionPolicy(ctx context.Context, orgSlug slug.Slug) (model.OrganizationRetentionPolicy, error)
	UpdateRetentionPolicy(
		ctx context.Context,
		orgSlug slug.Slug,
		actor model.EventActor,
		policy model.OrganizationRetentionPolicy,
	) (model.OrganizationRetentionPolicy, error)
	UpdateOrganization(
		ctx context.Context,
		orgSlug slug.Slug,
		actor model.EventActor,
		update model.UpdateOrganization,
	) (*model.Organization, error)
}

Service defines the organization business logic.

func New

func New(
	txm postgres.TransactionManager,
	orgsRepo organizations.Repository,
	environmentsService DefaultEnvironmentsService,
	membersService memberssvc.Service,
	rolesService rolessvc.Service,
	eventProducer workerproducer.EventProducer,
	admission admissionsvc.Service,
	options ...Option,
) Service

New creates a new organization service.

func NewServiceWithLogging

func NewServiceWithLogging(base Service, logger *slog.Logger) Service

NewServiceWithLogging wraps base with method completion logging.

type ServiceWithLogging

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

ServiceWithLogging implements Service with method completion logging.

func (ServiceWithLogging) CreateOrganization

func (_d ServiceWithLogging) CreateOrganization(ctx context.Context, userSlug slug.Slug, actor model.EventActor, newOrg model.NewOrganization) (op1 *model.Organization, err error)

CreateOrganization implements Service.

func (ServiceWithLogging) DeleteOrganization

func (_d ServiceWithLogging) DeleteOrganization(ctx context.Context, orgSlug slug.Slug) (err error)

DeleteOrganization implements Service.

func (ServiceWithLogging) GetOrganization

func (_d ServiceWithLogging) GetOrganization(ctx context.Context, orgSlug slug.Slug) (op1 *model.Organization, err error)

GetOrganization implements Service.

func (ServiceWithLogging) GetRetentionPolicy

func (_d ServiceWithLogging) GetRetentionPolicy(ctx context.Context, orgSlug slug.Slug) (o1 model.OrganizationRetentionPolicy, err error)

GetRetentionPolicy implements Service.

func (ServiceWithLogging) ListOrganizations

func (_d ServiceWithLogging) ListOrganizations(ctx context.Context, userSlug slug.Slug, req model.ListRequest) (p1 model.ListResponse[model.OrganizationWithRole], err error)

ListOrganizations implements Service.

func (ServiceWithLogging) UpdateOrganization

func (_d ServiceWithLogging) UpdateOrganization(ctx context.Context, orgSlug slug.Slug, actor model.EventActor, update model.UpdateOrganization) (op1 *model.Organization, err error)

UpdateOrganization implements Service.

func (ServiceWithLogging) UpdateRetentionPolicy

func (_d ServiceWithLogging) UpdateRetentionPolicy(ctx context.Context, orgSlug slug.Slug, actor model.EventActor, policy model.OrganizationRetentionPolicy) (o1 model.OrganizationRetentionPolicy, err error)

UpdateRetentionPolicy implements Service.

Jump to

Keyboard shortcuts

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