Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNameRequired = errors.New("tenant name is required") ErrNameTooShort = errors.New("tenant name must be at least 2 characters") ErrNameTooLong = errors.New("tenant name must not exceed 100 characters") ErrSlugRequired = errors.New("tenant slug is required") ErrSlugInvalid = errors.New("tenant slug must contain only lowercase letters, numbers, and hyphens") ErrTenantNotFound = errors.New("tenant not found") ErrTenantExists = errors.New("tenant already exists") ErrTenantInactive = errors.New("tenant is inactive") )
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository interface {
Create(ctx context.Context, tenant *Tenant) error
GetByID(ctx context.Context, id string) (*Tenant, error)
GetBySlug(ctx context.Context, slug string) (*Tenant, error)
Update(ctx context.Context, tenant *Tenant) error
Delete(ctx context.Context, id string) error
List(ctx context.Context, limit int) ([]*Tenant, error)
ListByStatus(ctx context.Context, status Status, limit int) ([]*Tenant, error)
}
Repository defines data access for tenants Note: Tenant operations do NOT require tenantID parameter since tenants are the top-level entity in our multi-tenant architecture
type Tenant ¶
type Tenant struct {
ID string
Name string // Display name (e.g., "Acme Corporation")
Slug string // URL-friendly identifier (e.g., "acme-corp")
Status Status
CreatedAt time.Time
UpdatedAt time.Time
// CWE-359: IP address tracking for GDPR compliance (90-day expiration)
CreatedFromIPAddress string // Encrypted IP address
CreatedFromIPTimestamp time.Time // For 90-day expiration tracking
ModifiedFromIPAddress string // Encrypted IP address
ModifiedFromIPTimestamp time.Time // For 90-day expiration tracking
}
Tenant represents a tenant in the system Each tenant is a separate customer/organization
Click to show internal directories.
Click to hide internal directories.