shared

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTenantCreated       = "tenant.created"
	EventTenantUpdated       = "tenant.updated"
	EventTenantDeleted       = "tenant.deleted"
	EventTenantMemberAdded   = "tenant.member.added"
	EventTenantMemberRemoved = "tenant.member.removed"
)

Event topic constants.

Variables

View Source
var (
	ErrTenantNotFound      = errors.New("tenant not found")
	ErrTenantCodeExists    = errors.New("tenant code already exists")
	ErrInvalidTenant       = errors.New("invalid tenant data")
	ErrMemberExists        = errors.New("user is already a member")
	ErrMemberNotFound      = errors.New("membership not found")
	ErrPlatformDomainOnly  = errors.New("operation requires platform domain")
	ErrParentTenantInvalid = errors.New("invalid parent tenant")
)

Tenant errors.

Functions

This section is empty.

Types

type MemberEventData

type MemberEventData struct {
	TenantID uuid.UUID `json:"tenantId"`
	UserID   uuid.UUID `json:"userId"`
	Role     string    `json:"role"`
	ActorID  uuid.UUID `json:"actorId"`
}

MemberEventData is the payload for membership events.

type RoleSeeder

type RoleSeeder interface {
	SeedBaselineRoles(ctx context.Context, domainID uuid.UUID) error
}

RoleSeeder seeds baseline roles for a new tenant domain.

type TenantEventData

type TenantEventData struct {
	TenantID   uuid.UUID `json:"tenantId"`
	TenantCode string    `json:"tenantCode"`
	DomainID   uuid.UUID `json:"domainId"`
	ActorID    uuid.UUID `json:"actorId"`
}

TenantEventData is the payload for tenant lifecycle events.

type TenantInfo

type TenantInfo struct {
	ID       uuid.UUID `json:"id"`
	Code     string    `json:"code"`
	Name     string    `json:"name"`
	Status   string    `json:"status"`
	DomainID uuid.UUID `json:"domainId"`
}

TenantInfo is the cross-plugin tenant summary.

type TenantServiceAPI

type TenantServiceAPI interface {
	GetTenant(ctx context.Context, id uuid.UUID) (*TenantInfo, error)
	GetTenantByCode(ctx context.Context, code string) (*TenantInfo, error)
	IsMember(ctx context.Context, tenantID, userID uuid.UUID) (bool, error)
	GetDomainID(ctx context.Context, tenantCode string) (uuid.UUID, error)
}

TenantServiceAPI is the public interface exposed to other plugins. Consumers resolve it via: plugin.Resolve[TenantServiceAPI](services, "tenant.service")

type UserInfo

type UserInfo struct {
	ID       uuid.UUID
	Username string
	Email    string
	Nickname string
	Status   string
}

UserInfo is a minimal user representation for membership checks.

type UserLookup

type UserLookup interface {
	GetUser(ctx context.Context, userID uuid.UUID) (*UserInfo, error)
}

UserLookup resolves user info for membership validation.

Jump to

Keyboard shortcuts

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