organization

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTenantMemberService

func NewTenantMemberService(
	memberRepo port.TenantMemberRepository,
	userRepo port.UserRepository,
) organizationuc.TenantMemberUseCase

NewTenantMemberService creates a new tenant member service.

func NewTenantService

func NewTenantService(
	tenantRepo port.TenantRepository,
	workspaceRepo port.WorkspaceRepository,
	tenantMemberRepo port.TenantMemberRepository,
	systemRoleRepo port.SystemRoleRepository,
	accessHistoryRepo port.UserAccessHistoryRepository,
) organizationuc.TenantUseCase

NewTenantService creates a new tenant service.

func NewWorkspaceMemberService

func NewWorkspaceMemberService(
	memberRepo port.WorkspaceMemberRepository,
	userRepo port.UserRepository,
) organizationuc.WorkspaceMemberUseCase

NewWorkspaceMemberService creates a new workspace member service.

func NewWorkspaceService

func NewWorkspaceService(
	workspaceRepo port.WorkspaceRepository,
	tenantRepo port.TenantRepository,
	memberRepo port.WorkspaceMemberRepository,
	accessHistoryRepo port.UserAccessHistoryRepository,
) organizationuc.WorkspaceUseCase

NewWorkspaceService creates a new workspace service.

Types

type TenantMemberService

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

TenantMemberService implements tenant member business logic.

func (*TenantMemberService) AddMember

AddMember adds a user to a tenant. Creates a shadow user if the email doesn't exist.

func (*TenantMemberService) CountOwners

func (s *TenantMemberService) CountOwners(ctx context.Context, tenantID string) (int, error)

CountOwners counts the number of TENANT_OWNER members in a tenant.

func (*TenantMemberService) GetMember

func (s *TenantMemberService) GetMember(ctx context.Context, memberID string) (*entity.TenantMemberWithUser, error)

GetMember retrieves a specific tenant member by ID.

func (*TenantMemberService) ListMembers

func (s *TenantMemberService) ListMembers(ctx context.Context, tenantID string) ([]*entity.TenantMemberWithUser, error)

ListMembers lists all members of a tenant.

func (*TenantMemberService) RemoveMember

RemoveMember removes a member from the tenant.

func (*TenantMemberService) UpdateMemberRole

UpdateMemberRole updates a tenant member's role.

type TenantService

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

TenantService implements tenant business logic.

func (*TenantService) CreateTenant

CreateTenant creates a new tenant. System workspace is auto-created via DB trigger.

func (*TenantService) DeleteTenant

func (s *TenantService) DeleteTenant(ctx context.Context, id string) error

DeleteTenant deletes a tenant and all its data.

func (*TenantService) GetTenant

func (s *TenantService) GetTenant(ctx context.Context, id string) (*entity.Tenant, error)

GetTenant retrieves a tenant by ID.

func (*TenantService) GetTenantByCode

func (s *TenantService) GetTenantByCode(ctx context.Context, code string) (*entity.Tenant, error)

GetTenantByCode retrieves a tenant by its code.

func (*TenantService) ListTenantWorkspaces

func (s *TenantService) ListTenantWorkspaces(ctx context.Context, tenantID string, filters port.WorkspaceFilters) ([]*entity.Workspace, int64, error)

ListTenantWorkspaces lists workspaces for a tenant with optional search (system admin use).

func (*TenantService) ListTenantsPaginated

func (s *TenantService) ListTenantsPaginated(ctx context.Context, filters port.TenantFilters) ([]*entity.Tenant, int64, error)

ListTenantsPaginated lists tenants with pagination.

func (*TenantService) ListUserTenants

func (s *TenantService) ListUserTenants(ctx context.Context, userID string) ([]*entity.TenantWithRole, error)

ListUserTenants lists all tenants a user belongs to with their roles.

func (*TenantService) ListUserTenantsPaginated

func (s *TenantService) ListUserTenantsPaginated(ctx context.Context, userID string, filters port.TenantMemberFilters) ([]*entity.TenantWithRole, int64, error)

ListUserTenantsPaginated lists tenants a user belongs to with pagination and optional search. If the user has a system role (SUPERADMIN or PLATFORM_ADMIN), returns all tenants.

func (*TenantService) SearchTenants

func (s *TenantService) SearchTenants(ctx context.Context, query string) ([]*entity.Tenant, error)

SearchTenants searches tenants by name or code similarity.

func (*TenantService) UpdateTenant

UpdateTenant updates a tenant's details.

func (*TenantService) UpdateTenantStatus

UpdateTenantStatus updates a tenant's status (ACTIVE, SUSPENDED, ARCHIVED).

type WorkspaceMemberService

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

WorkspaceMemberService implements workspace member business logic.

func (*WorkspaceMemberService) GetMember

func (s *WorkspaceMemberService) GetMember(ctx context.Context, memberID string) (*entity.MemberWithUser, error)

GetMember retrieves a specific member by ID.

func (*WorkspaceMemberService) InviteMember

InviteMember invites a user to join a workspace. Creates a shadow user if the email doesn't exist.

func (*WorkspaceMemberService) ListMembers

func (s *WorkspaceMemberService) ListMembers(ctx context.Context, workspaceID string) ([]*entity.MemberWithUser, error)

ListMembers lists all members of a workspace.

func (*WorkspaceMemberService) RemoveMember

RemoveMember removes a member from the workspace.

func (*WorkspaceMemberService) UpdateMemberRole

UpdateMemberRole updates a member's role within the workspace.

type WorkspaceService

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

WorkspaceService implements workspace business logic.

func (*WorkspaceService) ActivateWorkspace

func (s *WorkspaceService) ActivateWorkspace(ctx context.Context, id string) error

ActivateWorkspace activates a workspace.

func (*WorkspaceService) ArchiveWorkspace

func (s *WorkspaceService) ArchiveWorkspace(ctx context.Context, id string) error

ArchiveWorkspace archives a workspace (soft delete).

func (*WorkspaceService) CreateWorkspace

CreateWorkspace creates a new workspace.

func (*WorkspaceService) GetSystemWorkspace

func (s *WorkspaceService) GetSystemWorkspace(ctx context.Context, tenantID *string) (*entity.Workspace, error)

GetSystemWorkspace retrieves the system workspace for a tenant.

func (*WorkspaceService) GetWorkspace

func (s *WorkspaceService) GetWorkspace(ctx context.Context, id string) (*entity.Workspace, error)

GetWorkspace retrieves a workspace by ID.

func (*WorkspaceService) ListUserWorkspaces

func (s *WorkspaceService) ListUserWorkspaces(ctx context.Context, userID string) ([]*entity.WorkspaceWithRole, error)

ListUserWorkspaces lists all workspaces a user has access to.

func (*WorkspaceService) ListWorkspacesPaginated

func (s *WorkspaceService) ListWorkspacesPaginated(ctx context.Context, tenantID, userID string, filters port.WorkspaceFilters) ([]*entity.Workspace, int64, error)

ListWorkspacesPaginated lists workspaces for a tenant with pagination and optional search.

func (*WorkspaceService) UpdateWorkspace

UpdateWorkspace updates a workspace's details.

func (*WorkspaceService) UpdateWorkspaceStatus

UpdateWorkspaceStatus updates a workspace's status (ACTIVE, SUSPENDED, ARCHIVED).

Jump to

Keyboard shortcuts

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