Skip to content

Account

Commands

AccountCommandActivate

AccountCommandActivate is a domain command to activate an account.

Domain Command Struct:

go
type AccountCommandActivate struct {
	// Outline of the command
	Email string `json:"email"` // Email of the account to activate.
}

Domain Command Handling Method: AccountCommandActivate is a domain command handler handling the activation of an account. (AccountCommandActivate)

go
func (ch *commandHandler) AccountCommandActivate(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandActivate) ([]comby.Event, error)

AccountCommandCreate

Domain Command Struct:

go
type AccountCommandCreate struct {
	AccountUuid string `json:"accountUuid"`
	Email       string `json:"email,omitempty"`
	Password    string `json:"password,omitempty"`
	AuthModel   string `json:"authModel,omitempty"` // default: emailpassword (available: emailpassword, opaque)
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandCreate(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandCreate) ([]comby.Event, error)

AccountCommandLogin

AccountCommandLogin validates credentials and creates a session in one step. DEPRECATED: Use AccountCommandCreateLoginSession for the new MFA flow.

Domain Command Struct:

go
type AccountCommandLogin struct {
	AuthModel   string `json:"authModel,omitempty"` // "emailPassword" or "opaque"
	SessionUuid string `json:"sessionUuid"`
	SessionKey  string `json:"sessionKey"`
	Email       string `json:"email"`
	// emailpassword only fields
	Password string `json:"password"`
	// opaque only fields
	SessionData []byte `json:"sessionData"` // OPAQUE session key data
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandLogin(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandLogin) ([]comby.Event, error)

AccountCommandCreateLoginSession

AccountCommandCreateLoginSession creates a login session after credentials have been validated. This is used in the new MFA flow where credentials are validated before MFA.

Domain Command Struct:

go
type AccountCommandCreateLoginSession struct {
	AuthModel   string `json:"authModel"` // "emailPassword" or "opaque"
	SessionUuid string `json:"sessionUuid"`
	SessionKey  string `json:"sessionKey"`
	Email       string `json:"email"`
}

Domain Command Handling Method: AccountCommandCreateLoginSession handler creates a login session after credentials have been validated.

go
func (ch *commandHandler) AccountCommandCreateLoginSession(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandCreateLoginSession) ([]comby.Event, error)

AccountCommandLoginOAuth

TODO: MOBVE TO LOGIN OPTION!

Domain Command Struct:

go
type AccountCommandLoginOAuth struct {
	AccountUuid string `json:"accountUuid"`
	Email       string `json:"email,omitempty"`
	NewPassword string `json:"newPassword,omitempty"`
	SessionUuid string `json:"sessionUuid"`
	SessionKey  string `json:"sessionKey"`
	Attributes  string `json:"attributes,omitempty"`
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandLoginOAuth(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandLoginOAuth) ([]comby.Event, error)

AccountCommandLogout

AccountCommandLogout handles logging out of a user account or session, with strict access control to ensure security and proper authorization.

This command enforces the following rules:

  1. Self-Logout:
  • A user can log out their own account or session.
  • This ensures users have full control over their own sessions while preventing unauthorized access to other accounts.
  1. System Tenant Authorization:
  • Only the system tenant is permitted to log out other users or their sessions.
  • This restriction ensures that account-wide or cross-tenant session management is tightly controlled and limited to system-level administrators.

Domain Command Struct:

go
type AccountCommandLogout struct {
	AccountUuid string `json:"accountUuid,omitempty"`
	SessionUuid string `json:"sessionUuid,omitempty"`
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandLogout(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandLogout) ([]comby.Event, error)

AccountCommandPasswordReset

Domain Command Struct:

go
type AccountCommandPasswordReset struct {
	AccountUuid            string                         `json:"accountUuid"`
	NewPassword            string                         `json:"newPassword,omitempty"`            // emailPassword
	OpaqueCredentialRecord *opaque.OpaqueCredentialRecord `json:"opaqueCredentialRecord,omitempty"` // opaque
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandPasswordReset(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandPasswordReset) ([]comby.Event, error)

AccountCommandRegister

Domain Command Struct:

go
type AccountCommandRegister struct {
	AuthModel       string `json:"authModel,omitempty"` // "emailPassword" or "opaque"
	AccountUuid     string `json:"accountUuid"`
	InvitationToken string `json:"invitationToken,omitempty"`
	Email           string `json:"email"`
	// emailpassword only fields
	Password string `json:"password"`
	// opaque only fields
	OpaqueCredentialRecord *opaque.OpaqueCredentialRecord `json:"opaqueCredentialRecord"`
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandRegister(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandRegister) ([]comby.Event, error)

AccountCommandCreateRegistration

AccountCommandCreateRegistration creates an account after MFA confirmation. This is the new MFA flow where credentials are pre-validated before sending MFA.

Domain Command Struct:

go
type AccountCommandCreateRegistration struct {
	AuthModel       string `json:"authModel,omitempty"` // "emailPassword" or "opaque"
	AccountUuid     string `json:"accountUuid"`
	InvitationToken string `json:"invitationToken,omitempty"`
	Email           string `json:"email"`
	// emailpassword only fields
	Password string `json:"password"`
	// opaque only fields
	OpaqueCredentialRecord *opaque.OpaqueCredentialRecord `json:"opaqueCredentialRecord"`
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandCreateRegistration(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandCreateRegistration) ([]comby.Event, error)

AccountCommandRemove

AccountCommandRemove handles the deletion of accounts, with strict rules to ensure proper access control.

This command enforces the following restrictions:

  1. Self-Deletion Prohibited:
  • A user cannot delete their own account under any circumstances. This ensures a safeguard against accidental or unauthorized self-deletion.
  1. System Tenant Authorization:
  • Only system tenants are permitted to delete accounts belonging to other users or tenants.
  • This restriction ensures that account deletion is controlled centrally and prevents unauthorized cross-tenant modifications.

Domain Command Struct:

go
type AccountCommandRemove struct {
	AccountUuid string `json:"accountUuid"`
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandRemove) ([]comby.Event, error)

AccountCommandRemoveAttribute

Domain Command Struct:

go
type AccountCommandRemoveAttribute struct {
	AccountUuid string `json:"accountUuid"`
	Key         string `json:"key"`
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandRemoveAttribute) ([]comby.Event, error)

AccountCommandSetAttribute

Domain Command Struct:

go
type AccountCommandSetAttribute struct {
	AccountUuid string `json:"accountUuid"`
	Key         string `json:"key"`
	Value       any    `json:"value"`
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandSetAttribute) ([]comby.Event, error)

AccountCommandUpdate

Domain Command Struct:

go
type AccountCommandUpdate struct {
	AccountUuid   string   `json:"accountUuid"`
	Attributes    string   `json:"attributes,omitempty"`
	PatchedFields []string `json:"patchedFields"`
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandUpdate(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandUpdate) ([]comby.Event, error)

AccountCommandUpdateCredentials

AccountCommandUpdateCredentials handles updating the credentials (email and password) of an account, with strict access control to ensure security and proper authorization.

This command enforces the following rules:

  1. Self-Account Update:
  • A user can only update the credentials of their own account.
  • This restriction ensures users cannot modify the credentials of other accounts, maintaining strict isolation.
  1. System Tenant Administrator Override:
  • The system tenant administrator is allowed to update credentials for any account.
  • This provides a controlled mechanism for administrative recovery or management of user credentials.

Domain Command Struct:

go
type AccountCommandUpdateCredentials struct {
	AuthModel   string `json:"authModel,omitempty"` // "emailPassword" or "opaque"
	AccountUuid string `json:"accountUuid"`
	// common fields
	CurrentEmail string `json:"currentEmail,omitempty"`
	NewEmail     string `json:"newEmail,omitempty"`
	// emailpassword only fields
	CurrentPassword string `json:"currentPassword,omitempty"`
	NewPassword     string `json:"newPassword,omitempty"`
	// opaque only fields
	OpaqueCredentialRecord *opaque.OpaqueCredentialRecord `json:"opaqueCredentialRecord"`
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandUpdateCredentials(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandUpdateCredentials) ([]comby.Event, error)

AccountCommandUpdateState

Domain Command Struct:

go
type AccountCommandUpdateState struct {
	AccountUuid string `json:"accountUuid"`
	State       string `json:"state"`
}

Domain Command Handling Method:

go
func (ch *commandHandler) AccountCommandUpdateState(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandUpdateState) ([]comby.Event, error)

Queries

Domain Query Structs:

Domain Query Responses:

AccountQueryList

AccountQueryList returns a list of accounts based on the context of the requestor.

This query exhibits unique behavior, as its results vary depending on the context of the requesting entity. Specifically, the query's outcome can be classified into three distinct cases:

  1. System Tenant Context:
  • When the requestor represents the system tenant, the query retrieves all accounts.
  • This includes not only the accounts directly tied to the system tenant but also any identities belonging to other tenants.
  • This behavior ensures that the system tenant maintains global visibility across all tenant identities.
  1. Specific Tenant Context:
  • If the requestor represents a specific tenant, the query returns all accounts associated with that tenant.
  • Importantly, it excludes accounts or identities that are linked to other tenants.
  • This ensures that a tenant's view remains isolated, adhering to a strict multi-tenancy principle.
  1. Equal Sender and Target Context:
  • In cases where an account requests the list of accounts, the query returns only the requesting account itself.
  • This includes all identities associated with the requesting account, regardless of their tenant.
  • This behavior ensures that the account sees only its own information while maintaining visibility into all related identities.

Domain Query Struct:

go
type AccountQueryList struct {
	Page           int64  `json:"page,omitempty"`
	PageSize       int64  `json:"pageSize,omitempty"`
	OrderBy        string `json:"orderBy,omitempty"`
	Attributes     string `json:"attributes,omitempty"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qh *queryHandler) AccountQueryList(ctx context.Context, qry comby.Query, domainQry *AccountQueryList) (*AccountQueryListResponse, error)

AccountQueryModelByEmail

Domain Query Struct:

go
type AccountQueryModelByEmail struct {
	Email string `json:"email"`
}

Domain Query Handling Method:

go
func (qh *queryHandler) AccountQueryModelByEmail(ctx context.Context, qry comby.Query, domainQry *AccountQueryModelByEmail) (*AccountQueryItemResponse, error)

AccountQueryModelEmailPassword

Domain Query Struct:

go
type AccountQueryModelEmailPassword struct {
	Email              string `json:"email"`
	Password           string `json:"password"`
	IncludeLastSession bool   `json:"includeLastSession,omitempty"`
	IncludeAllSessions bool   `json:"includeAllSessions,omitempty"`
}

Domain Query Handling Method:

go
func (qh *queryHandler) AccountQueryModelEmailPassword(ctx context.Context, qry comby.Query, domainQry *AccountQueryModelEmailPassword) (*AccountQueryItemResponse, error)

AccountQueryModel

Domain Query Struct:

go
type AccountQueryModel struct {
	AccountUuid    string `json:"accountUuid"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qh *queryHandler) AccountQueryModel(ctx context.Context, qry comby.Query, domainQry *AccountQueryModel) (*AccountQueryItemResponse, error)

AccountQueryListResponse

go
type AccountQueryListResponse struct {
	Items    []*readmodel.AccountModel `json:"items,omitempty"`
	Total    int64                     `json:"total,omitempty"`
	Page     int64                     `json:"page,omitempty"`
	PageSize int64                     `json:"pageSize,omitempty"`
}

AccountQueryItemResponse

go
type AccountQueryItemResponse struct {
	Item *readmodel.AccountModel `json:"item,omitempty"`
}

Events

AccountLoggedInEvent

Domain Event Struct:

go
type AccountLoggedInEvent struct {
	AuthModel   string `json:"authModel,omitempty"`
	SessionUuid string `json:"sessionUuid"`
	SessionKey  string `json:"sessionKey"`
	ExpiredAt   int64  `json:"expiredAt"`
}

Domain Event Handling Method:

go
func (agg *Account) AccountLoggedInEvent(ctx context.Context, evt comby.Event, domainEvt *AccountLoggedInEvent) (error)

AccountLoggedOutEvent

Domain Event Struct:

go
type AccountLoggedOutEvent struct {
	SessionUuid string `json:"sessionUuid"`
}

Domain Event Handling Method:

go
func (agg *Account) AccountLoggedOutEvent(ctx context.Context, evt comby.Event, domainEvt *AccountLoggedOutEvent) (error)

AccountPasswordResetEvent

Domain Event Struct:

go
type AccountPasswordResetEvent struct {
	State                  string                         `json:"state"`
	NewHashedPassword      string                         `json:"newHashedPassword,omitempty"`
	OpaqueCredentialRecord *opaque.OpaqueCredentialRecord `json:"opaqueCredentialRecord,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Account) AccountPasswordResetEvent(ctx context.Context, evt comby.Event, domainEvt *AccountPasswordResetEvent) (error)

AccountRegisteredEvent

Domain Event Struct:

go
type AccountRegisteredEvent struct {
	State                  string                         `json:"state,omitempty"`
	AuthModel              string                         `json:"authModel,omitempty"`
	Email                  string                         `json:"email,omitempty"`
	OpaqueCredentialRecord *opaque.OpaqueCredentialRecord `json:"opaqueCredentialRecord,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Account) AccountRegisteredEvent(ctx context.Context, evt comby.Event, domainEvt *AccountRegisteredEvent) (error)

AccountRemovedEvent

Domain Event Struct:

go
type AccountRemovedEvent struct {
	State  string `json:"state,omitempty"`
	Reason string `json:"reason,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Account) AccountRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountRemovedEvent) (error)

AccountAttributeRemovedEvent

Domain Event Struct:

go
type AccountAttributeRemovedEvent struct {
	Key string `json:"key"`
}

Domain Event Handling Method:

go
func (agg *Account) AccountAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountAttributeRemovedEvent) (error)

AccountAttributeSetEvent

Domain Event Struct:

go
type AccountAttributeSetEvent struct {
	Key   string `json:"key"`
	Value any    `json:"value"`
}

Domain Event Handling Method:

go
func (agg *Account) AccountAttributeSetEvent(ctx context.Context, evt comby.Event, domainEvt *AccountAttributeSetEvent) (error)

AccountUpdatedEvent

Domain Event Struct:

go
type AccountUpdatedEvent struct {
	Attributes string `json:"attributes,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Account) AccountUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountUpdatedEvent) (error)

AccountCredentialsUpdatedEvent

Domain Event Struct:

go
type AccountCredentialsUpdatedEvent struct {
	AuthModel              string                         `json:"authModel,omitempty"`
	Email                  string                         `json:"email,omitempty"`
	Password               string                         `json:"password,omitempty"`
	OpaqueCredentialRecord *opaque.OpaqueCredentialRecord `json:"opaqueCredentialRecord,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Account) AccountCredentialsUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountCredentialsUpdatedEvent) (error)

AccountStateUpdatedEvent

Domain Event Struct:

go
type AccountStateUpdatedEvent struct {
	State string `json:"state"`
}

Domain Event Handling Method:

go
func (agg *Account) AccountStateUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountStateUpdatedEvent) (error)

Aggregate

Account represents the root aggregate for managing authentication and session handling.

  • Credentials: Attributes for email, password, and the next allowed login time.
  • CredentialsOpaque: OPAQUE credentials for passwordless authentication.
  • Session: Details about active user sessions, including a unique session UUID, session key, and expiration time.

Aggregate Struct:

go
type Account struct {
	*comby.BaseAggregate
	// Entities
	Credentials       *Credentials
	CredentialsOpaque *CredentialsOpaque
	Sessions          []*Session
	// Value Objects
	State string
}

Methods

ValidateLoginCredentials

ValidateLoginCredentials validates the login credentials without creating a session. This is used in the pre-auth flow where credentials are validated before MFA.

go
func (agg *Account) ValidateLoginCredentials(opts ) (error)

CreateLoginSession

CreateLoginSession creates a new login session after credentials have been validated. This is used after MFA confirmation in the new pre-auth flow.

go
func (agg *Account) CreateLoginSession(sessionUuid, sessionKey string, authModel string) (error)

Login

Login validates credentials and creates a session in one step. DEPRECATED: Use ValidateLoginCredentials + CreateLoginSession for the new MFA flow.

go
func (agg *Account) Login(sessionUuid, sessionKey string, opts ) (error)

Logout

go
func (agg *Account) Logout(opts ) (error)

PasswordReset

go
func (agg *Account) PasswordReset(opts ) (error)

ValidateRegistration

ValidateRegistration validates registration data without creating events. This should be called BEFORE sending MFA challenge. It validates email format only - email uniqueness must be checked by the caller.

go
func (agg *Account) ValidateRegistration(opts ) (error)

CreateAccount

CreateAccount creates a new account and generates registration events. This should be called AFTER MFA confirmation.

go
func (agg *Account) CreateAccount(state string, opts ) (error)

Register

Register creates a new account with credentials. DEPRECATED: Use ValidateRegistration + CreateAccount for the new MFA flow.

go
func (agg *Account) Register(state string, opts ) (error)

Remove

go
func (agg *Account) Remove(opts ) (error)

RemoveAttribute

go
func (agg *Account) RemoveAttribute(opts ) (error)

SetAttribute

go
func (agg *Account) SetAttribute(opts ) (error)

Update

go
func (agg *Account) Update(opts ) (error)

UpdateCredentials

go
func (agg *Account) UpdateCredentials(opts ) (error)

UpdateState

go
func (agg *Account) UpdateState(opts ) (error)

Event Handlers

AccountReadmodel

Domain EventMethod
tenantAggregate.TenantCreatedEventTenantCreatedEvent
tenantAggregate.TenantAttributeRemovedEventTenantAttributeRemovedEvent
tenantAggregate.TenantAttributeSetEventTenantAttributeSetEvent
tenantAggregate.TenantUpdatedEventTenantUpdatedEvent
tenantAggregate.TenantRemovedEventTenantRemovedEvent
identityAggregate.IdentityAttributeRemovedEventIdentityAttributeRemovedEvent
identityAggregate.IdentityCreatedEventIdentityCreatedEvent
identityAggregate.IdentityAttributeSetEventIdentityAttributeSetEvent
identityAggregate.IdentityRemovedEventIdentityRemovedEvent
identityAggregate.IdentityUpdatedEventIdentityUpdatedEvent
identityAggregate.IdentityProfileUpdatedEventIdentityProfileUpdatedEvent
identityAggregate.IdentityRemovedGroupEventIdentityRemovedGroupEvent
identityAggregate.IdentityAddedGroupEventIdentityAddedGroupEvent
groupAggregate.GroupRemovedEventGroupRemovedEvent
groupAggregate.GroupUpdatedEventGroupUpdatedEvent
groupAggregate.GroupAddedEventGroupAddedEvent
accountAggregate.AccountRegisteredEventAccountRegisteredEvent
accountAggregate.AccountStateUpdatedEventAccountStateUpdatedEvent
accountAggregate.AccountUpdatedEventAccountUpdatedEvent
accountAggregate.AccountAttributeRemovedEventAccountAttributeRemovedEvent
accountAggregate.AccountAttributeSetEventAccountAttributeSetEvent
accountAggregate.AccountLoggedOutEventAccountLoggedOutEvent
accountAggregate.AccountLoggedInEventAccountLoggedInEvent
accountAggregate.AccountCredentialsUpdatedEventAccountCredentialsUpdatedEvent
accountAggregate.AccountRemovedEventAccountRemovedEvent
accountAggregate.AccountPasswordResetEventAccountPasswordResetEvent

Custom Permissions

NameTypeComment
AccountCommandActivateCommandActivate an existing account
AccountCommandPasswordResetCommandReset password of an existing account
AccountCommandCreateCommandCreate new account manually
AccountCommandLoginOAuthCommandLogin into an existing account using OAuth
AccountCommandLoginCommandLogin into an existing account
AccountCommandCreateLoginSessionCommandCreate a login session after credentials have been validated
AccountCommandLogoutCommandLogout an account
AccountCommandRegisterCommandRegister new account
AccountCommandCreateRegistrationCommandCreate new account registration
AccountCommandRemoveCommandRemove existing account
AccountCommandUpdateCredentialsCommandUpdate credentials of an existing account
AccountCommandUpdateCommandUpdate account
AccountCommandSetAttributeCommandSet single attribute of an existing account
AccountCommandRemoveAttributeCommandRemove single attribute of an existing account
AccountCommandUpdateStateCommandUpdate state of an existing account
AccountQueryModelEmailPasswordQueryRequest account details by email and password
AccountQueryModelQueryRequest account details

Asset

Commands

AssetCommandAdd

Domain Command Struct:

go
type AssetCommandAdd struct {
	AssetUuid        string `json:"assetUuid"`
	IdentityUuid     string `json:"identityUuid,omitempty"`
	AssetName        string `json:"assetName,omitempty"`
	AssetSize        int64  `json:"assetSize,omitempty"`
	AssetContentType string `json:"assetContentType,omitempty"`
	WorkspaceUuid    string `json:"workspaceUuid,omitempty"` // Optional workspace UUID for workspace-scoped assets
	Attributes       string `json:"attributes,omitempty"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) AssetCommandAdd(ctx context.Context, cmd comby.Command, domainCmd *AssetCommandAdd) ([]comby.Event, error)

AssetCommandRemove

Domain Command Struct:

go
type AssetCommandRemove struct {
	AssetUuid string `json:"assetUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) AssetCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *AssetCommandRemove) ([]comby.Event, error)

AssetCommandRemoveAttribute

Domain Command Struct:

go
type AssetCommandRemoveAttribute struct {
	AssetUuid string `json:"assetUuid"`
	Key       string `json:"key"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) AssetCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *AssetCommandRemoveAttribute) ([]comby.Event, error)

AssetCommandSetAttribute

Domain Command Struct:

go
type AssetCommandSetAttribute struct {
	AssetUuid string `json:"assetUuid"`
	Key       string `json:"key"`
	Value     any    `json:"value"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) AssetCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *AssetCommandSetAttribute) ([]comby.Event, error)

AssetCommandUpdate

Domain Command Struct:

go
type AssetCommandUpdate struct {
	IdentityUuid     string   `json:"identityUuid"`
	AssetUuid        string   `json:"assetUuid"`
	AssetName        string   `json:"assetName,omitempty"`
	AssetSize        int64    `json:"assetSize,omitempty"`
	AssetContentType string   `json:"assetContentType,omitempty"`
	Attributes       string   `json:"attributes,omitempty"`
	PatchedFields    []string `json:"patchedFields"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) AssetCommandUpdate(ctx context.Context, cmd comby.Command, domainCmd *AssetCommandUpdate) ([]comby.Event, error)

Queries

Domain Query Structs:

Domain Query Responses:

AssetQueryDownload

Domain Query Struct:

go
type AssetQueryDownload struct {
	AssetUuid string `json:"assetUuid"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) AssetQueryDownload(ctx context.Context, qry comby.Query, domainQry *AssetQueryDownload) (*AssetQueryItemResponse, error)

AssetQueryList

Domain Query Struct:

go
type AssetQueryList struct {
	TenantUuid     string `json:"tenantUuid"`
	WorkspaceUuid  string `json:"workspaceUuid,omitempty"`
	Page           int64  `json:"page,omitempty"`
	PageSize       int64  `json:"pageSize,omitempty"`
	OrderBy        string `json:"orderBy,omitempty"`
	Attributes     string `json:"attributes,omitempty"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) AssetQueryList(ctx context.Context, qry comby.Query, domainQry *AssetQueryList) (*AssetQueryListResponse, error)

AssetQueryModelByBucketObject

Domain Query Struct:

go
type AssetQueryModelByBucketObject struct {
	BucketName string `json:"bucketName"`
	ObjectName string `json:"objectName"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) AssetQueryModelByBucketObject(ctx context.Context, qry comby.Query, domainQry *AssetQueryModelByBucketObject) (*AssetQueryItemResponse, error)

AssetQueryModel

Domain Query Struct:

go
type AssetQueryModel struct {
	AssetUuid      string `json:"assetUuid"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) AssetQueryModel(ctx context.Context, qry comby.Query, domainQry *AssetQueryModel) (*AssetQueryItemResponse, error)

AssetQueryItemResponse

go
type AssetQueryItemResponse struct {
	Item *readmodel.AssetModel `json:"item,omitempty"`
}

AssetQueryListResponse

go
type AssetQueryListResponse struct {
	Items    []*readmodel.AssetModel `json:"items,omitempty"`
	Total    int64                   `json:"total,omitempty"`
	Page     int64                   `json:"page,omitempty"`
	PageSize int64                   `json:"pageSize,omitempty"`
}

Events

AssetAddedEvent

Domain Event Struct:

go
type AssetAddedEvent struct {
	IdentityUuid     string `json:"identityUuid,omitempty"`
	AssetName        string `json:"assetName,omitempty"`
	AssetSize        int64  `json:"assetSize,omitempty"`
	AssetContentType string `json:"assetContentType,omitempty"`
	BucketName       string `json:"bucketName,omitempty"`
	ObjectName       string `json:"objectName,omitempty"`
	WorkspaceUuid    string `json:"workspaceUuid,omitempty"` // Optional workspace UUID for workspace-scoped assets
	Attributes       string `json:"attributes,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Asset) AssetAddedEvent(ctx context.Context, evt comby.Event, domainEvt *AssetAddedEvent) (error)

AssetRemovedEvent

Domain Event Struct:

go
type AssetRemovedEvent struct {
	Reason string `json:"reason,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Asset) AssetRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *AssetRemovedEvent) (error)

AssetAttributeRemovedEvent

Domain Event Struct:

go
type AssetAttributeRemovedEvent struct {
	Key string `json:"key"`
}

Domain Event Handling Method:

go
func (agg *Asset) AssetAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *AssetAttributeRemovedEvent) (error)

AssetAttributeSetEvent

Domain Event Struct:

go
type AssetAttributeSetEvent struct {
	Key   string `json:"key"`
	Value any    `json:"value"`
}

Domain Event Handling Method:

go
func (agg *Asset) AssetAttributeSetEvent(ctx context.Context, evt comby.Event, domainEvt *AssetAttributeSetEvent) (error)

AssetUpdatedEvent

Domain Event Struct:

go
type AssetUpdatedEvent struct {
	IdentityUuid     string `json:"identityUuid,omitempty"`
	AssetName        string `json:"assetName,omitempty"`
	AssetSize        int64  `json:"assetSize,omitempty"`
	AssetContentType string `json:"assetContentType,omitempty"`
	BucketName       string `json:"bucketName,omitempty"`
	ObjectName       string `json:"objectName,omitempty"`
	Attributes       string `json:"attributes,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Asset) AssetUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *AssetUpdatedEvent) (error)

Aggregate

Aggregate Struct:

go
type Asset struct {
	*comby.BaseAggregate
	// References
	IdentityUuid string
	// WorkspaceUuid - when set, this asset is scoped to a specific workspace
	WorkspaceUuid string
	// Value Objects (asset)
	Name        string
	Size        int64
	ContentType string
	Path        string
	// Value Objects (storage)
	BucketName string
	ObjectName string
}

Methods

Add

go
func (agg *Asset) Add(opts ) (error)

Remove

go
func (agg *Asset) Remove(opts ) (error)

RemoveAttribute

go
func (agg *Asset) RemoveAttribute(opts ) (error)

SetAttribute

go
func (agg *Asset) SetAttribute(opts ) (error)

Update

go
func (agg *Asset) Update(opts ) (error)

Event Handlers

AssetReadmodel

Domain EventMethod
workspaceAggregate.WorkspaceUpdatedEventWorkspaceUpdatedEvent
workspaceAggregate.WorkspaceRemovedEventWorkspaceRemovedEvent
workspaceAggregate.WorkspaceCreatedEventWorkspaceCreatedEvent
tenantAggregate.TenantCreatedEventTenantCreatedEvent
tenantAggregate.TenantUpdatedEventTenantUpdatedEvent
tenantAggregate.TenantRemovedEventTenantRemovedEvent
identityAggregate.IdentityProfileUpdatedEventIdentityProfileUpdatedEvent
identityAggregate.IdentityRemovedEventIdentityRemovedEvent
identityAggregate.IdentityCreatedEventIdentityCreatedEvent
assetAggregate.AssetAddedEventAssetAddedEvent
assetAggregate.AssetAttributeRemovedEventAssetAttributeRemovedEvent
assetAggregate.AssetAttributeSetEventAssetAttributeSetEvent
assetAggregate.AssetRemovedEventAssetRemovedEvent
assetAggregate.AssetUpdatedEventAssetUpdatedEvent

Custom Permissions

NameTypeComment
AssetCommandAddCommandCreate and upload asset
AssetCommandRemoveCommandRemove existing asset
AssetCommandUpdateCommandUpdate existing asset
AssetCommandSetAttributeCommandSet single attribute for existing asset
AssetCommandRemoveAttributeCommandRemove single attribute from existing asset
AssetQueryDownloadQueryDownload existing asset
AssetQueryListQueryList all assets
AssetQueryModelQueryGet asset
AssetQueryModelByBucketObjectQueryGet asset by bucket and object name

Auth

Commands

CommandWithoutTargetAggregate

Domain Command Struct:

go
type CommandWithoutTargetAggregate struct {
	NewAggAUuid string `json:"newAggAUuid"`
	Name        string
}

Domain Command Handling Method:

go
func (cs *commandHandler) CommandHandlerWithoutTargetAggregateUuid(ctx context.Context, cmd comby.Command, domainCmd *CommandWithoutTargetAggregate) ([]comby.Event, error)

CommandWithTargetAggregate

Domain Command Struct:

go
type CommandWithTargetAggregate struct {
	AggAUuid string `json:"aggAUuid"`
	Name     string
}

Domain Command Handling Method:

go
func (cs *commandHandler) CommandHandlerWithTargetAggregateUuid(ctx context.Context, cmd comby.Command, domainCmd *CommandWithTargetAggregate) ([]comby.Event, error)

Events

AggACreated


Domain Event Struct:

go
type AggACreated struct {
	AggAUuid string `json:"aggAUuid"`
	Other    string `json:"other,omitempty"`
}

Domain Event Handling Method:

go
func (agg *AggA) AggACreated(ctx context.Context, evt comby.Event, domainEvt *AggACreated) (error)

AggAModified

Domain Event Struct:

go
type AggAModified struct {
	AggAUuid string `json:"aggAUuid"`
	Other    string `json:"other,omitempty"`
}

Domain Event Handling Method:

go
func (agg *AggA) AggAModified(ctx context.Context, evt comby.Event, domainEvt *AggAModified) (error)

Aggregate


Aggregate Struct:

go
type AggA struct {
	*comby.BaseAggregate
	Other string
}

Methods

CreateAggA

go
func (agg *AggA) CreateAggA(other string) (error)

ModifyAggA

go
func (agg *AggA) ModifyAggA(other string) (error)

Event Handlers

AccountCtxReadmodel

Domain EventMethod
workspaceAggregate.WorkspaceWorkspaceMemberRemovedEventWorkspaceWorkspaceMemberRemovedEvent
workspaceAggregate.WorkspaceWorkspaceMemberAddedEventWorkspaceWorkspaceMemberAddedEvent
workspaceAggregate.WorkspaceGroupRemovedEventWorkspaceGroupRemovedEvent
workspaceAggregate.WorkspaceGroupUpdatedEventWorkspaceGroupUpdatedEvent
workspaceAggregate.WorkspaceGroupAddedEventWorkspaceGroupAddedEvent
workspaceAggregate.WorkspaceMemberRemovedEventWorkspaceMemberRemovedEvent
workspaceAggregate.WorkspaceMemberAddedEventWorkspaceMemberAddedEvent
workspaceAggregate.WorkspaceRemovedEventWorkspaceRemovedEvent
workspaceAggregate.WorkspaceCreatedEventWorkspaceCreatedEvent
tenantAggregate.TenantCreatedEventTenantCreatedEvent
tenantAggregate.TenantRemovedEventTenantRemovedEvent
identityAggregate.IdentityRemovedTokenEventIdentityRemovedTokenEvent
identityAggregate.IdentityCreatedEventIdentityCreatedEvent
identityAggregate.IdentityAddedTokenEventIdentityAddedTokenEvent
identityAggregate.IdentityRemovedEventIdentityRemovedEvent
identityAggregate.IdentityAddedGroupEventIdentityAddedGroupEvent
identityAggregate.IdentityRemovedGroupEventIdentityRemovedGroupEvent
groupAggregate.GroupRemovedEventGroupRemovedEvent
groupAggregate.GroupUpdatedEventGroupUpdatedEvent
groupAggregate.GroupAddedEventGroupAddedEvent
accountAggregate.AccountRegisteredEventAccountRegisteredEvent
accountAggregate.AccountAttributeRemovedEventAccountAttributeRemovedEvent
accountAggregate.AccountAttributeSetEventAccountAttributeSetEvent
accountAggregate.AccountLoggedOutEventAccountLoggedOutEvent
accountAggregate.AccountLoggedInEventAccountLoggedInEvent
accountAggregate.AccountCredentialsUpdatedEventAccountCredentialsUpdatedEvent
accountAggregate.AccountRemovedEventAccountRemovedEvent
accountAggregate.AccountPasswordResetEventAccountPasswordResetEvent
comby.AllDomainEventOnHandleEventForTenantAggregateTuples
comby.AllDomainEventOnHandleEventForWorkspaceAggregateTuples

Custom Permissions

NameTypeComment
CommandCommandWithoutTargetAggregate
CommandCommandWithTargetAggregate
CommandCommandWithoutTargetAggregate
CommandCommandWithTargetAggregate
IdentityQueryModelQueryIdentityQueryModel
WorkspaceQueryListByIdentityQueryWorkspaceQueryListByIdentity
CommandCommandWithoutTargetAggregate
CommandCommandWithTargetAggregate

Group

Commands

GroupCommandCreate

Domain Command Struct:

go
type GroupCommandCreate struct {
	GroupUuid   string   `json:"groupUuid"`
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Attributes  string   `json:"attributes,omitempty"`
	Permissions []string `json:"permissions,omitempty"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) GroupCommandCreate(ctx context.Context, cmd comby.Command, domainCmd *GroupCommandCreate) ([]comby.Event, error)

GroupCommandRemove

Domain Command Struct:

go
type GroupCommandRemove struct {
	GroupUuid string `json:"groupUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) GroupCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *GroupCommandRemove) ([]comby.Event, error)

GroupCommandRemoveAttribute

Domain Command Struct:

go
type GroupCommandRemoveAttribute struct {
	GroupUuid string `json:"groupUuid"`
	Key       string `json:"key"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) GroupCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *GroupCommandRemoveAttribute) ([]comby.Event, error)

GroupCommandSetAttribute

Domain Command Struct:

go
type GroupCommandSetAttribute struct {
	GroupUuid string `json:"groupUuid"`
	Key       string `json:"key"`
	Value     any    `json:"value"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) GroupCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *GroupCommandSetAttribute) ([]comby.Event, error)

GroupCommandUpdate

Domain Command Struct:

go
type GroupCommandUpdate struct {
	GroupUuid     string   `json:"groupUuid"`
	Name          string   `json:"name,omitempty"`
	Description   string   `json:"description,omitempty"`
	Attributes    string   `json:"attributes,omitempty"`
	Permissions   []string `json:"permissions,omitempty"`
	PatchedFields []string `json:"patchedFields" doc:"list of fields that should be patched - comma separated" example:"field1,field2"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) GroupCommandUpdate(ctx context.Context, cmd comby.Command, domainCmd *GroupCommandUpdate) ([]comby.Event, error)

Queries

Domain Query Structs:

Domain Query Responses:

GroupQueryList

Domain Query Struct:

go
type GroupQueryList struct {
	TenantUuid     string `json:"tenantUuid"`
	Page           int64  `json:"page,omitempty"`
	PageSize       int64  `json:"pageSize,omitempty"`
	OrderBy        string `json:"orderBy,omitempty"`
	Attributes     string `json:"attributes,omitempty"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) GroupQueryList(ctx context.Context, qry comby.Query, domainQry *GroupQueryList) (*GroupQueryListResponse, error)

GroupQueryModelByName

Domain Query Struct:

go
type GroupQueryModelByName struct {
	Name string `json:"name"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) GroupQueryModelByName(ctx context.Context, qry comby.Query, domainQry *GroupQueryModelByName) (*GroupQueryItemResponse, error)

GroupQueryModel

Domain Query Struct:

go
type GroupQueryModel struct {
	GroupUuid      string `json:"groupUuid"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) GroupQueryModel(ctx context.Context, qry comby.Query, domainQry *GroupQueryModel) (*GroupQueryItemResponse, error)

GroupQueryListResponse

go
type GroupQueryListResponse struct {
	Items    []*readmodel.GroupModel `json:"items,omitempty"`
	Total    int64                   `json:"total,omitempty"`
	Page     int64                   `json:"page,omitempty"`
	PageSize int64                   `json:"pageSize,omitempty"`
}

GroupQueryItemResponse

go
type GroupQueryItemResponse struct {
	Item *readmodel.GroupModel `json:"item,omitempty"`
}

Events

GroupAddedEvent

Domain Event Struct:

go
type GroupAddedEvent struct {
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Attributes  string   `json:"attributes,omitempty"`
	Permissions []string `json:"permissions,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Group) GroupAddedEvent(ctx context.Context, evt comby.Event, domainEvt *GroupAddedEvent) (error)

GroupRemovedEvent

Domain Event Struct:

go
type GroupRemovedEvent struct {
	Reason string `json:"reason,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Group) GroupRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *GroupRemovedEvent) (error)

GroupAttributeRemovedEvent

Domain Event Struct:

go
type GroupAttributeRemovedEvent struct {
	Key string `json:"key"`
}

Domain Event Handling Method:

go
func (agg *Group) GroupAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *GroupAttributeRemovedEvent) (error)

GroupAttributeSetEvent

Domain Event Struct:

go
type GroupAttributeSetEvent struct {
	Key   string `json:"key"`
	Value any    `json:"value"`
}

Domain Event Handling Method:

go
func (agg *Group) GroupAttributeSetEvent(ctx context.Context, evt comby.Event, domainEvt *GroupAttributeSetEvent) (error)

GroupUpdatedEvent

Domain Event Struct:

go
type GroupUpdatedEvent struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Attributes  string   `json:"attributes,omitempty"`
	Permissions []string `json:"permissions,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Group) GroupUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *GroupUpdatedEvent) (error)

Aggregate

Aggregate Struct:

go
type Group struct {
	*comby.BaseAggregate
	// Value Objects
	Permissions []string
	Name        string
	Description string
}

Methods

Add

go
func (agg *Group) Add(opts ) (error)

Remove

go
func (agg *Group) Remove(opts ) (error)

RemoveAttribute

go
func (agg *Group) RemoveAttribute(opts ) (error)

SetAttribute

go
func (agg *Group) SetAttribute(opts ) (error)

Update

go
func (agg *Group) Update(opts ) (error)

Event Handlers

GroupReadmodel

Domain EventMethod
tenantAggregate.TenantCreatedEventTenantCreatedEvent
tenantAggregate.TenantRemovedEventTenantRemovedEvent
tenantAggregate.TenantUpdatedEventTenantUpdatedEvent
groupAggregate.GroupAddedEventGroupAddedEvent
groupAggregate.GroupUpdatedEventGroupUpdatedEvent
groupAggregate.GroupRemovedEventGroupRemovedEvent
groupAggregate.GroupAttributeSetEventGroupAttributeSetEvent
groupAggregate.GroupAttributeRemovedEventGroupAttributeRemovedEvent

Custom Permissions

NameTypeComment
GroupCommandCreateCommandCreate new group
GroupCommandUpdateCommandUpdate existing group
GroupCommandRemoveCommandRemove existing group
GroupCommandSetAttributeCommandSet single attribute of existing group
GroupCommandRemoveAttributeCommandRemove single attribute from existing group
GroupQueryListQueryList groups
GroupQueryModelQueryGet group by id
GroupQueryModelByNameQueryGet group by name

Identity

Commands

IdentityCommandAddGroup

Domain Command Struct:

go
type IdentityCommandAddGroup struct {
	IdentityUuid string `json:"identityUuid"`
	GroupUuid    string `json:"groupUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) IdentityCommandAddGroup(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandAddGroup) ([]comby.Event, error)

IdentityCommandAddToken

Domain Command Struct:

go
type IdentityCommandAddToken struct {
	IdentityUuid string `json:"identityUuid"`
	TokenUuid    string `json:"tokenUuid"`
	TokenValue   string `json:"tokenValue"`
	Name         string `json:"name,omitempty"`
	Description  string `json:"description,omitempty"`
	ExpiredAt    int64  `json:"expiredAt,omitempty"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) IdentityCommandAddToken(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandAddToken) ([]comby.Event, error)

IdentityCommandCreate

Domain Command Struct:

go
type IdentityCommandCreate struct {
	IdentityUuid string   `json:"identityUuid"`
	AccountUuid  string   `json:"accountUuid,omitempty"`
	GroupUuids   []string `json:"groupUuids"`
	Attributes   string   `json:"attributes,omitempty"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) IdentityCommandCreate(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandCreate) ([]comby.Event, error)

IdentityCommandRemove

Domain Command Struct:

go
type IdentityCommandRemove struct {
	IdentityUuid string `json:"identityUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) IdentityCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandRemove) ([]comby.Event, error)

IdentityCommandRemoveAttribute

Domain Command Struct:

go
type IdentityCommandRemoveAttribute struct {
	IdentityUuid string `json:"identityUuid"`
	Key          string `json:"key"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) IdentityCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandRemoveAttribute) ([]comby.Event, error)

IdentityCommandRemoveGroup

Domain Command Struct:

go
type IdentityCommandRemoveGroup struct {
	IdentityUuid string `json:"identityUuid"`
	GroupUuid    string `json:"groupUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) IdentityCommandRemoveGroup(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandRemoveGroup) ([]comby.Event, error)

IdentityCommandRemoveToken

Domain Command Struct:

go
type IdentityCommandRemoveToken struct {
	IdentityUuid string `json:"identityUuid"`
	TokenUuid    string `json:"tokenUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) IdentityCommandRemoveToken(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandRemoveToken) ([]comby.Event, error)

IdentityCommandSetAttribute

Domain Command Struct:

go
type IdentityCommandSetAttribute struct {
	IdentityUuid string `json:"identityUuid"`
	Key          string `json:"key"`
	Value        any    `json:"value"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) IdentityCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandSetAttribute) ([]comby.Event, error)

IdentityCommandUpdate

Domain Command Struct:

go
type IdentityCommandUpdate struct {
	IdentityUuid  string   `json:"identityUuid"`
	Attributes    string   `json:"attributes,omitempty"`
	PatchedFields []string `json:"patchedFields"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) IdentityCommandUpdate(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandUpdate) ([]comby.Event, error)

IdentityCommandUpdateProfile

Domain Command Struct:

go
type IdentityCommandUpdateProfile struct {
	IdentityUuid  string   `json:"identityUuid"`
	Name          string   `json:"name,omitempty"`
	Email         string   `json:"email,omitempty"`
	Title         string   `json:"title,omitempty"`
	Avatar        string   `json:"avatar,omitempty"`
	PatchedFields []string `json:"patchedFields" doc:"list of fields that should be patched - comma separated" example:"field1,field2"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) IdentityCommandUpdateProfile(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandUpdateProfile) ([]comby.Event, error)

Queries

Domain Query Structs:

Domain Query Responses:

IdentityQueryListByAccountUuid

Domain Query Struct:

go
type IdentityQueryListByAccountUuid struct {
	AccountUuid string `json:"accountUuid"`
	Page        int64  `json:"page,omitempty"`
	PageSize    int64  `json:"pageSize,omitempty"`
	OrderBy     string `json:"orderBy,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) IdentityQueryListByAccountUuid(ctx context.Context, qry comby.Query, domainQry *IdentityQueryListByAccountUuid) (*IdentityQueryListResponse, error)

IdentityQueryListByAccountTenantUuid

Domain Query Struct:

go
type IdentityQueryListByAccountTenantUuid struct {
	TenantUuid  string `json:"tenantUuid"`
	AccountUuid string `json:"accountUuid"`
	Page        int64  `json:"page,omitempty"`
	PageSize    int64  `json:"pageSize,omitempty"`
	OrderBy     string `json:"orderBy,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) IdentityQueryListByAccountTenantUuid(ctx context.Context, qry comby.Query, domainQry *IdentityQueryListByAccountTenantUuid) (*IdentityQueryListResponse, error)

IdentityQueryList

Domain Query Struct:

go
type IdentityQueryList struct {
	TenantUuid     string `json:"tenantUuid"`
	Page           int64  `json:"page,omitempty"`
	PageSize       int64  `json:"pageSize,omitempty"`
	OrderBy        string `json:"orderBy,omitempty"`
	Attributes     string `json:"attributes,omitempty"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) IdentityQueryList(ctx context.Context, qry comby.Query, domainQry *IdentityQueryList) (*IdentityQueryListResponse, error)

IdentityQueryModel

Domain Query Struct:

go
type IdentityQueryModel struct {
	IdentityUuid   string `json:"identityUuid"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) IdentityQueryModel(ctx context.Context, qry comby.Query, domainQry *IdentityQueryModel) (*IdentityQueryItemResponse, error)

IdentityQueryListResponse

go
type IdentityQueryListResponse struct {
	Items    []*readmodel.IdentityModel `json:"items,omitempty"`
	Total    int64                      `json:"total,omitempty"`
	Page     int64                      `json:"page,omitempty"`
	PageSize int64                      `json:"pageSize,omitempty"`
}

IdentityQueryItemResponse

go
type IdentityQueryItemResponse struct {
	Item *readmodel.IdentityModel `json:"item,omitempty"`
}

Events

IdentityAddedGroupEvent

Domain Event Struct:

go
type IdentityAddedGroupEvent struct {
	GroupUuid string `json:"groupUuid"`
}

Domain Event Handling Method:

go
func (agg *Identity) IdentityAddedGroupEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityAddedGroupEvent) (error)

IdentityAddedTokenEvent

Domain Event Struct:

go
type IdentityAddedTokenEvent struct {
	TokenUuid   string `json:"tokenUuid"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	TokenValue  string `json:"tokenValue"`
	ExpiredAt   int64  `json:"expiredAt,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Identity) IdentityAddedTokenEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityAddedTokenEvent) (error)

IdentityCreatedEvent

Domain Event Struct:

go
type IdentityCreatedEvent struct {
	AccountUuid string `json:"accountUuid,omitempty"`
	Attributes  string `json:"attributes,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Identity) IdentityCreatedEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityCreatedEvent) (error)

IdentityRemovedEvent

Domain Event Struct:

go
type IdentityRemovedEvent struct {
	Reason string `json:"reason,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Identity) IdentityRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityRemovedEvent) (error)

IdentityAttributeRemovedEvent

Domain Event Struct:

go
type IdentityAttributeRemovedEvent struct {
	Key string `json:"key"`
}

Domain Event Handling Method:

go
func (agg *Identity) IdentityAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityAttributeRemovedEvent) (error)

IdentityRemovedGroupEvent

Domain Event Struct:

go
type IdentityRemovedGroupEvent struct {
	GroupUuid string `json:"groupUuid"`
}

Domain Event Handling Method:

go
func (agg *Identity) IdentityRemovedGroupEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityRemovedGroupEvent) (error)

IdentityRemovedTokenEvent

Domain Event Struct:

go
type IdentityRemovedTokenEvent struct {
	TokenUuid string `json:"tokenUuid"`
}

Domain Event Handling Method:

go
func (agg *Identity) IdentityRemovedTokenEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityRemovedTokenEvent) (error)

IdentityAttributeSetEvent

Domain Event Struct:

go
type IdentityAttributeSetEvent struct {
	Key   string `json:"key"`
	Value any    `json:"value"`
}

Domain Event Handling Method:

go
func (agg *Identity) IdentityAttributesSetEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityAttributeSetEvent) (error)

IdentityUpdatedEvent

Domain Event Struct:

go
type IdentityUpdatedEvent struct {
	Attributes string `json:"attributes,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Identity) IdentityUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityUpdatedEvent) (error)

IdentityProfileUpdatedEvent

Domain Event Struct:

go
type IdentityProfileUpdatedEvent struct {
	Name   string `json:"name,omitempty"`
	Email  string `json:"email,omitempty"`
	Title  string `json:"title,omitempty"`
	Avatar string `json:"avatar,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Identity) IdentityProfileUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityProfileUpdatedEvent) (error)

Aggregate

Aggregate Struct:

go
type Identity struct {
	*comby.BaseAggregate
	// References
	AccountUuid string
	GroupUuids  []string
	// Entities
	Profile *Profile
	Tokens  []*Token
}

Methods

AddGroup

go
func (agg *Identity) AddGroup(opts ) (error)

AddToken

go
func (agg *Identity) AddToken(opts ) (error)

Add

go
func (agg *Identity) Add(opts ) (error)

Remove

go
func (agg *Identity) Remove(opts ) (error)

RemoveAttribute

go
func (agg *Identity) RemoveAttribute(opts ) (error)

RemoveGroup

go
func (agg *Identity) RemoveGroup(opts ) (error)

RemoveToken

go
func (agg *Identity) RemoveToken(opts ) (error)

SetAttribute

go
func (agg *Identity) SetAttribute(opts ) (error)

Update

go
func (agg *Identity) Update(opts ) (error)

UpdateProfile

go
func (agg *Identity) UpdateProfile(opts ) (error)

Event Handlers

IdentityReadmodel

Domain EventMethod
tenantAggregate.TenantCreatedEventTenantCreatedEvent
tenantAggregate.TenantAttributeRemovedEventTenantAttributeRemovedEvent
tenantAggregate.TenantAttributeSetEventTenantAttributeSetEvent
tenantAggregate.TenantUpdatedEventTenantUpdatedEvent
tenantAggregate.TenantRemovedEventTenantRemovedEvent
identityAggregate.IdentityAttributeRemovedEventIdentityAttributeRemovedEvent
identityAggregate.IdentityRemovedTokenEventIdentityRemovedTokenEvent
identityAggregate.IdentityUpdatedEventIdentityUpdatedEvent
identityAggregate.IdentityRemovedEventIdentityRemovedEvent
identityAggregate.IdentityAddedGroupEventIdentityAddedGroupEvent
identityAggregate.IdentityRemovedGroupEventIdentityRemovedGroupEvent
identityAggregate.IdentityAddedTokenEventIdentityAddedTokenEvent
identityAggregate.IdentityCreatedEventIdentityCreatedEvent
identityAggregate.IdentityProfileUpdatedEventIdentityProfileUpdatedEvent
identityAggregate.IdentityAttributeSetEventIdentityAttributeSetEvent
groupAggregate.GroupUpdatedEventGroupUpdatedEvent
groupAggregate.GroupRemovedEventGroupRemovedEvent
groupAggregate.GroupAddedEventGroupAddedEvent
assetAggregate.AssetAddedEventAssetAddedEvent
assetAggregate.AssetRemovedEventAssetRemovedEvent
assetAggregate.AssetUpdatedEventAssetUpdatedEvent

Custom Permissions

NameTypeComment
IdentityCommandAddTokenCommandAdd token for any other identity
IdentityCommandRemoveTokenCommandRemove token of any other identity
IdentityCommandUpdateProfileCommandUpdate profile of any other identity
IdentityCommandSetAttributeCommandSet attributes of any other identity
IdentityQueryModelQueryGet identity model of any identity

Invitation

Commands

InvitationCommandAccept

Domain Command Struct:

go
type InvitationCommandAccept struct {
	InvitationUuid     string `json:"invitationUuid"`
	AccountUuid        string `json:"accountUuid"`
	TargetIdentityUuid string `json:"targetIdentityUuid,omitempty"`
	Token              string `json:"token"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) InvitationCommandAccept(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandAccept) ([]comby.Event, error)

InvitationCommandCreate

Domain Command Struct:

go
type InvitationCommandCreate struct {
	InvitationUuid      string   `json:"invitationUuid"`
	IdentityUuid        string   `json:"identityUuid"`
	GroupUuids          []string `json:"groupUuids,omitempty"`          // Tenant-level groups
	WorkspaceUuid       string   `json:"workspaceUuid,omitempty"`       // Optional workspace UUID for workspace-scoped invitations
	WorkspaceGroupUuids []string `json:"workspaceGroupUuids,omitempty"` // Workspace-level groups (requires workspace context)
	Email               string   `json:"email"`
	Attributes          string   `json:"attributes,omitempty"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) InvitationCommandCreate(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandCreate) ([]comby.Event, error)

InvitationCommandDecline

Domain Command Struct:

go
type InvitationCommandDecline struct {
	InvitationUuid string `json:"invitationUuid"`
	AccountUuid    string `json:"accountUuid"`
	Token          string `json:"token"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) InvitationCommandDecline(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandDecline) ([]comby.Event, error)

InvitationCommandRemove

Domain Command Struct:

go
type InvitationCommandRemove struct {
	InvitationUuid string `json:"invitationUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) InvitationCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandRemove) ([]comby.Event, error)

InvitationCommandRemoveAttribute

Domain Command Struct:

go
type InvitationCommandRemoveAttribute struct {
	InvitationUuid string `json:"invitationUuid"`
	Key            string `json:"key"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) InvitationCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandRemoveAttribute) ([]comby.Event, error)

InvitationCommandSend

Domain Command Struct:

go
type InvitationCommandSend struct {
	InvitationUuid string `json:"invitationUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) InvitationCommandSend(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandSend) ([]comby.Event, error)

InvitationCommandSetAttribute

Domain Command Struct:

go
type InvitationCommandSetAttribute struct {
	InvitationUuid string `json:"invitationUuid"`
	Key            string `json:"key"`
	Value          any    `json:"value"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) InvitationCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandSetAttribute) ([]comby.Event, error)

InvitationCommandUpdate

Domain Command Struct:

go
type InvitationCommandUpdate struct {
	InvitationUuid string   `json:"invitationUuid"`
	Attributes     string   `json:"attributes,omitempty"`
	PatchedFields  []string `json:"patchedFields"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) InvitationCommandUpdate(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandUpdate) ([]comby.Event, error)

Queries

Domain Query Structs:

Domain Query Responses:

InvitationQueryList

Domain Query Struct:

go
type InvitationQueryList struct {
	TenantUuid     string `json:"tenantUuid"`
	Page           int64  `json:"page,omitempty"`
	PageSize       int64  `json:"pageSize,omitempty"`
	OrderBy        string `json:"orderBy,omitempty"`
	Attributes     string `json:"attributes,omitempty"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) InvitationQueryList(ctx context.Context, qry comby.Query, domainQry *InvitationQueryList) (*InvitationQueryListResponse, error)

InvitationQueryModel

Domain Query Struct:

go
type InvitationQueryModel struct {
	InvitationUuid string `json:"invitationUuid"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) InvitationQueryModel(ctx context.Context, qry comby.Query, domainQry *InvitationQueryModel) (*InvitationQueryItemResponse, error)

InvitationQueryModelByInvitationToken

Domain Query Struct:

go
type InvitationQueryModelByInvitationToken struct {
	InvitationToken string `json:"invitationToken"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) InvitationQueryModelByInvitationToken(ctx context.Context, qry comby.Query, domainQry *InvitationQueryModelByInvitationToken) (*InvitationQueryItemResponse, error)

InvitationQueryListResponse

go
type InvitationQueryListResponse struct {
	Items    []*readmodel.InvitationModel `json:"items,omitempty"`
	Total    int64                        `json:"total,omitempty"`
	Page     int64                        `json:"page,omitempty"`
	PageSize int64                        `json:"pageSize,omitempty"`
}

InvitationQueryItemResponse

go
type InvitationQueryItemResponse struct {
	Item *readmodel.InvitationModel `json:"item,omitempty"`
}

Events

InvitationAcceptedEvent

Domain Event Struct:

go
type InvitationAcceptedEvent struct {
	AccountUuid        string `json:"accountUuid"`
	TargetIdentityUuid string `json:"targetIdentityUuid,omitempty"` // if identity already exists
}

Domain Event Handling Method:

go
func (agg *Invitation) InvitationAcceptedEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationAcceptedEvent) (error)

InvitationCreatedEvent

Domain Event Struct:

go
type InvitationCreatedEvent struct {
	IdentityUuid        string   `json:"identityUuid"`
	GroupUuids          []string `json:"groupUuids,omitempty"`          // Tenant-level groups
	WorkspaceGroupUuids []string `json:"workspaceGroupUuids,omitempty"` // Workspace-level groups
	WorkspaceUuid       string   `json:"workspaceUuid,omitempty"`       // Optional workspace UUID for workspace-scoped invitations
	Token               string   `json:"token"`
	Email               string   `json:"email"`
	Attributes          string   `json:"attributes,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Invitation) InvitationCreatedEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationCreatedEvent) (error)

InvitationDeclinedEvent

Domain Event Struct:

go
type InvitationDeclinedEvent struct {
	AccountUuid string `json:"accountUuid"`
}

Domain Event Handling Method:

go
func (agg *Invitation) InvitationDeclinedEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationDeclinedEvent) (error)

InvitationRemovedEvent

Domain Event Struct:

go
type InvitationRemovedEvent struct {
	Reason string `json:"reason,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Invitation) InvitationRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationRemovedEvent) (error)

InvitationAttributeRemovedEvent

Domain Event Struct:

go
type InvitationAttributeRemovedEvent struct {
	Key string `json:"key"`
}

Domain Event Handling Method:

go
func (agg *Invitation) InvitationAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationAttributeRemovedEvent) (error)

InvitationSentEvent

Domain Event Struct:

go
type InvitationSentEvent struct {
	State string `json:"state"`
}

Domain Event Handling Method:

go
func (agg *Invitation) InvitationSentEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationSentEvent) (error)

InvitationAttributeSetEvent

Domain Event Struct:

go
type InvitationAttributeSetEvent struct {
	Key   string `json:"key"`
	Value any    `json:"value"`
}

Domain Event Handling Method:

go
func (agg *Invitation) InvitationAttributeSetEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationAttributeSetEvent) (error)

InvitationUpdatedEvent

Domain Event Struct:

go
type InvitationUpdatedEvent struct {
	Attributes string `json:"attributes,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Invitation) InvitationUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationUpdatedEvent) (error)

Aggregate

Aggregate Struct:

go
type Invitation struct {
	*comby.BaseAggregate
	// GroupUuids groups to which the invited account will be added (tenant-level)
	GroupUuids []string
	// WorkspaceUuid - when set, this invitation is for a specific workspace
	WorkspaceUuid string
	// WorkspaceGroupUuids groups to which the invited account will be added (workspace-level)
Only used when WorkspaceUuid is set
	WorkspaceGroupUuids []string
	// IdentityUuid who created the invitation
	IdentityUuid string
	// AccountUuid who accepted the invitation
	AccountUuid string
	// Value Objects
	TargetIdentityUuid string
	Token string
	Email string
	State string
}

Methods

Accept

go
func (agg *Invitation) Accept(opts ) (error)

Create

go
func (agg *Invitation) Create(opts ) (error)

Decline

go
func (agg *Invitation) Decline(opts ) (error)

Remove

go
func (agg *Invitation) Remove(opts ) (error)

RemoveAttribute

go
func (agg *Invitation) RemoveAttribute(opts ) (error)

Send

go
func (agg *Invitation) Send(opts ) (error)

SetAttribute

go
func (agg *Invitation) SetAttribute(opts ) (error)

Update

go
func (agg *Invitation) Update(opts ) (error)

Event Handlers

Reactor

Domain EventMethod
aggregateInvitation.InvitationAcceptedEventInvitationAcceptedEvent
aggregateInvitation.InvitationCreatedEventInvitationCreatedEvent

InvitationReadmodel

Domain EventMethod
workspaceAggregate.WorkspaceUpdatedEventWorkspaceUpdatedEvent
workspaceAggregate.WorkspaceRemovedEventWorkspaceRemovedEvent
workspaceAggregate.WorkspaceCreatedEventWorkspaceCreatedEvent
tenantAggregate.TenantCreatedEventTenantCreatedEvent
tenantAggregate.TenantUpdatedEventTenantUpdatedEvent
tenantAggregate.TenantRemovedEventTenantRemovedEvent
aggregate.InvitationAcceptedEventInvitationAcceptedEvent
aggregate.InvitationAttributeRemovedEventInvitationAttributeRemovedEvent
aggregate.InvitationUpdatedEventInvitationUpdatedEvent
aggregate.InvitationRemovedEventInvitationRemovedEvent
aggregate.InvitationCreatedEventInvitationCreatedEvent
aggregate.InvitationDeclinedEventInvitationDeclinedEvent
aggregate.InvitationSentEventInvitationSentEvent
aggregate.InvitationAttributeSetEventInvitationAttributeSetEvent
identityAggregate.IdentityRemovedEventIdentityRemovedEvent
identityAggregate.IdentityProfileUpdatedEventIdentityProfileUpdatedEvent
identityAggregate.IdentityCreatedEventIdentityCreatedEvent
groupAggregate.GroupUpdatedEventGroupUpdatedEvent
groupAggregate.GroupRemovedEventGroupRemovedEvent
groupAggregate.GroupAddedEventGroupAddedEvent
accountAggregate.AccountCredentialsUpdatedEventAccountCredentialsUpdatedEvent

Tenant

Commands

TenantCommandCreate

Domain Command Struct:

go
type TenantCommandCreate struct {
	TenantUuid string `json:"tenantUuid"`
	Name       string `json:"name"`
	Attributes string `json:"attributes,omitempty"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) TenantCommandCreate(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandCreate) ([]comby.Event, error)

TenantCommandRemove

Domain Command Struct:

go
type TenantCommandRemove struct {
	TenantUuid string `json:"tenantUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) TenantCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandRemove) ([]comby.Event, error)

TenantCommandRemoveAttribute

Domain Command Struct:

go
type TenantCommandRemoveAttribute struct {
	TenantUuid string `json:"tenantUuid"`
	Key        string `json:"key"`
}

Domain Command Handling Method:

go
func (ch *commandHandler) TenantCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandRemoveAttribute) ([]comby.Event, error)

TenantCommandRemoveSecret

Domain Command Struct:

go
type TenantCommandRemoveSecret struct {
	TenantUuid string `json:"tenantUuid"`
	SecretKey  string `json:"secretKey"`
}

Domain Command Handling Method:

go
func (ch *commandHandler) TenantCommandRemoveSecret(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandRemoveSecret) ([]comby.Event, error)

TenantCommandSetAttribute

Domain Command Struct:

go
type TenantCommandSetAttribute struct {
	TenantUuid string `json:"tenantUuid"`
	Key        string `json:"key"`
	Value      any    `json:"value"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) TenantCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandSetAttribute) ([]comby.Event, error)

TenantCommandSetSecret

Domain Command Struct:

go
type TenantCommandSetSecret struct {
	TenantUuid  string `json:"tenantUuid"`
	SecretKey   string `json:"secretKey"`
	SecretValue string `json:"secretValue,omitempty"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) TenantCommandSetSecret(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandSetSecret) ([]comby.Event, error)

TenantCommandUpdate

Domain Command Struct:

go
type TenantCommandUpdate struct {
	TenantUuid    string   `json:"tenantUuid"`
	Name          string   `json:"name,omitempty"`
	Attributes    string   `json:"attributes,omitempty"`
	PatchedFields []string `json:"patchedFields" doc:"list of fields that should be patched - comma separated" example:"field1,field2"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) TenantCommandUpdate(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandUpdate) ([]comby.Event, error)

Queries

Domain Query Structs:

Domain Query Responses:

TenantQueryList

TenantQueryList returns a list of tenants based on the context of the requestor.

This query determines the list of tenants a requestor is allowed to access, with behavior depending on the requestor's context. The query outcome is classified into two distinct cases:

  1. System Tenant Context:
  • When the requestor represents the system tenant, the query retrieves a complete list of all tenants.
  • This includes tenants from all contexts, providing global visibility for the system tenant.
  1. Specific Tenant Context:
  • If the requestor represents a specific tenant, the query returns a list containing only the tenant associated with the requestor.
  • This ensures that the tenant has access only to its own information, adhering to strict isolation principles in a multi-tenant architecture.

Domain Query Struct:

go
type TenantQueryList struct {
	Page           int64  `json:"page,omitempty"`
	PageSize       int64  `json:"pageSize,omitempty"`
	OrderBy        string `json:"orderBy,omitempty"`
	Attributes     string `json:"attributes,omitempty"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) TenantQueryList(ctx context.Context, qry comby.Query, domainQry *TenantQueryList) (*TenantQueryListResponse, error)

TenantQueryModelByName

Domain Query Struct:

go
type TenantQueryModelByName struct {
	Name string `json:"name"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) TenantQueryModelByName(ctx context.Context, qry comby.Query, domainQry *TenantQueryModelByName) (*TenantQueryItemResponse, error)

TenantQueryModel

Domain Query Struct:

go
type TenantQueryModel struct {
	TenantUuid     string `json:"tenantUuid"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) TenantQueryModel(ctx context.Context, qry comby.Query, domainQry *TenantQueryModel) (*TenantQueryItemResponse, error)

TenantQueryListResponse

go
type TenantQueryListResponse struct {
	Items    []*readmodel.TenantModel `json:"items,omitempty"`
	Total    int64                    `json:"total,omitempty"`
	Page     int64                    `json:"page,omitempty"`
	PageSize int64                    `json:"pageSize,omitempty"`
}

TenantQueryItemResponse

go
type TenantQueryItemResponse struct {
	Item *readmodel.TenantModel `json:"item,omitempty"`
}

Events

TenantCreatedEvent

Domain Event Struct:

go
type TenantCreatedEvent struct {
	Name       string `json:"name"`
	Attributes string `json:"attributes,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Tenant) TenantCreatedEvent(ctx context.Context, evt comby.Event, domainEvt *TenantCreatedEvent) (error)

TenantRemovedEvent

Domain Event Struct:

go
type TenantRemovedEvent struct {
	Reason string `json:"reason,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Tenant) TenantRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *TenantRemovedEvent) (error)

TenantAttributeRemovedEvent

Domain Event Struct:

go
type TenantAttributeRemovedEvent struct {
	Key string `json:"key"`
}

Domain Event Handling Method:

go
func (agg *Tenant) TenantAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *TenantAttributeRemovedEvent) (error)

TenantSecretRemovedEvent

Domain Event Struct:

go
type TenantSecretRemovedEvent struct {
	SecretKey string `json:"secretKey"`
}

Domain Event Handling Method:

go
func (agg *Tenant) TenantSecretRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *TenantSecretRemovedEvent) (error)

TenantAttributeSetEvent

Domain Event Struct:

go
type TenantAttributeSetEvent struct {
	Key   string `json:"key"`
	Value any    `json:"value"`
}

Domain Event Handling Method:

go
func (agg *Tenant) TenantAttributeSetEvent(ctx context.Context, evt comby.Event, domainEvt *TenantAttributeSetEvent) (error)

TenantSecretSetEvent

Domain Event Struct:

go
type TenantSecretSetEvent struct {
	SecretKey   string `json:"SecretKey"`
	SecretValue string `json:"SecretValue,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Tenant) TenantSecretSetEvent(ctx context.Context, evt comby.Event, domainEvt *TenantSecretSetEvent) (error)

TenantUpdatedEvent

Domain Event Struct:

go
type TenantUpdatedEvent struct {
	Name       string `json:"name,omitempty"`
	Attributes string `json:"attributes,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Tenant) TenantUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *TenantUpdatedEvent) (error)

Aggregate

Aggregate Struct:

go
type Tenant struct {
	*comby.BaseAggregate
	// Value Objects
	Name    string
	Secrets *comby.Attributes
}

Methods

Create

go
func (agg *Tenant) Create(opts ) (error)

Remove

go
func (agg *Tenant) Remove(opts ) (error)

RemoveAttribute

go
func (agg *Tenant) RemoveAttribute(opts ) (error)

RemoveSecret

go
func (agg *Tenant) RemoveSecret(opts ) (error)

SetAttribute

go
func (agg *Tenant) SetAttribute(opts ) (error)

SetSecret

go
func (agg *Tenant) SetSecret(opts ) (error)

Update

go
func (agg *Tenant) Update(opts ) (error)

Event Handlers

TenantReadmodel

Domain EventMethod
webhookAggregate.WebhookRemovedEventWebhookRemovedEvent
webhookAggregate.WebhookAddedEventWebhookAddedEvent
tenantAggregate.TenantCreatedEventTenantCreatedEvent
tenantAggregate.TenantSecretRemovedEventTenantSecretRemovedEvent
tenantAggregate.TenantSecretSetEventTenantSecretSetEvent
tenantAggregate.TenantAttributeRemovedEventTenantAttributeRemovedEvent
tenantAggregate.TenantAttributeSetEventTenantAttributeSetEvent
tenantAggregate.TenantUpdatedEventTenantUpdatedEvent
tenantAggregate.TenantRemovedEventTenantRemovedEvent
invitationAggregate.InvitationCreatedEventInvitationCreatedEvent
invitationAggregate.InvitationRemovedEventInvitationRemovedEvent
identityAggregate.IdentityProfileUpdatedEventIdentityProfileUpdatedEvent
identityAggregate.IdentityRemovedEventIdentityRemovedEvent
identityAggregate.IdentityCreatedEventIdentityCreatedEvent
groupAggregate.GroupUpdatedEventGroupUpdatedEvent
groupAggregate.GroupRemovedEventGroupRemovedEvent
groupAggregate.GroupAddedEventGroupAddedEvent
assetAggregate.AssetAddedEventAssetAddedEvent
assetAggregate.AssetRemovedEventAssetRemovedEvent

Webhook

Commands

WebhookCommandAdd

Domain Command Struct:

go
type WebhookCommandAdd struct {
	WebhookUuid         string `json:"webhookUuid"`
	DomainEvtIdentifier string `json:"domainEvtIdentifier"`
	WebhookUrl          string `json:"webhookUrl"`
	WorkspaceUuid       string `json:"workspaceUuid,omitempty"` // Optional workspace UUID for workspace-scoped webhooks
	Attributes          string `json:"attributes,omitempty"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WebhookCommandAdd(ctx context.Context, cmd comby.Command, domainCmd *WebhookCommandAdd) ([]comby.Event, error)

WebhookCommandRemove

Domain Command Struct:

go
type WebhookCommandRemove struct {
	WebhookUuid string `json:"webhookUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WebhookCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *WebhookCommandRemove) ([]comby.Event, error)

WebhookCommandRemoveAttribute

Domain Command Struct:

go
type WebhookCommandRemoveAttribute struct {
	WebhookUuid string `json:"webhookUuid"`
	Key         string `json:"key"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WebhookCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *WebhookCommandRemoveAttribute) ([]comby.Event, error)

WebhookCommandSetAttribute

Domain Command Struct:

go
type WebhookCommandSetAttribute struct {
	WebhookUuid string `json:"webhookUuid"`
	Key         string `json:"key"`
	Value       any    `json:"value"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WebhookCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *WebhookCommandSetAttribute) ([]comby.Event, error)

WebhookCommandUpdate

Domain Command Struct:

go
type WebhookCommandUpdate struct {
	WebhookUuid         string   `json:"webhookUuid"`
	Active              bool     `json:"active,omitempty"`
	DomainEvtIdentifier string   `json:"domainEvtIdentifier,omitempty"`
	WebhookUrl          string   `json:"webhookUrl,omitempty"`
	Attributes          string   `json:"attributes,omitempty"`
	PatchedFields       []string `json:"patchedFields"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WebhookCommandUpdate(ctx context.Context, cmd comby.Command, domainCmd *WebhookCommandUpdate) ([]comby.Event, error)

Queries

Domain Query Structs:

Domain Query Responses:

WebhookQueryList

Domain Query Struct:

go
type WebhookQueryList struct {
	TenantUuid     string `json:"tenantUuid"`
	Page           int64  `json:"page,omitempty"`
	PageSize       int64  `json:"pageSize,omitempty"`
	OrderBy        string `json:"orderBy,omitempty"`
	Attributes     string `json:"attributes,omitempty"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryService) WebhookQueryList(ctx context.Context, qry comby.Query, domainQry *WebhookQueryList) (*WebhookQueryListResponse, error)

WebhookQueryModel

Domain Query Struct:

go
type WebhookQueryModel struct {
	WebhookUuid    string `json:"webhookUuid"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryService) WebhookQueryModel(ctx context.Context, qry comby.Query, domainQry *WebhookQueryModel) (*WebhookQueryItemResponse, error)

WebhookQueryListResponse

go
type WebhookQueryListResponse struct {
	Items    []*readmodel.WebhookModel `json:"items,omitempty"`
	Total    int64                     `json:"total,omitempty"`
	Page     int64                     `json:"page,omitempty"`
	PageSize int64                     `json:"pageSize,omitempty"`
}

WebhookQueryItemResponse

go
type WebhookQueryItemResponse struct {
	Item *readmodel.WebhookModel `json:"item,omitempty"`
}

Events

WebhookAddedEvent

Domain Event Struct:

go
type WebhookAddedEvent struct {
	DomainEvtIdentifier string `json:"domainEvtIdentifier"`
	WebhookUrl          string `json:"webhookUrl"`
	WorkspaceUuid       string `json:"workspaceUuid,omitempty"` // Optional workspace UUID for workspace-scoped webhooks
	Attributes          string `json:"attributes,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Webhook) WebhookAddedEvent(ctx context.Context, evt comby.Event, domainEvt *WebhookAddedEvent) (error)

WebhookRemovedEvent

Domain Event Struct:

go
type WebhookRemovedEvent struct {
	Reason string `json:"reason,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Webhook) WebhookRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *WebhookRemovedEvent) (error)

WebhookAttributeRemovedEvent

Domain Event Struct:

go
type WebhookAttributeRemovedEvent struct {
	Key string `json:"key"`
}

Domain Event Handling Method:

go
func (agg *Webhook) WebhookAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *WebhookAttributeRemovedEvent) (error)

WebhookAttributeSetEvent

Domain Event Struct:

go
type WebhookAttributeSetEvent struct {
	Key   string `json:"key"`
	Value any    `json:"value"`
}

Domain Event Handling Method:

go
func (agg *Webhook) WebhookAttributeSetEvent(ctx context.Context, evt comby.Event, domainEvt *WebhookAttributeSetEvent) (error)

WebhookUpdatedEvent

Domain Event Struct:

go
type WebhookUpdatedEvent struct {
	Active              bool   `json:"active"`
	DomainEvtIdentifier string `json:"domainEvtIdentifier"`
	WebhookUrl          string `json:"webhookUrl"`
	Attributes          string `json:"attributes,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Webhook) WebhookUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *WebhookUpdatedEvent) (error)

Aggregate

Aggregate Struct:

go
type Webhook struct {
	*comby.BaseAggregate
	// WorkspaceUuid - when set, this webhook is for a specific workspace
	WorkspaceUuid string
	// Value Objects
	Active              bool
	DomainEvtIdentifier string
	WebhookUrl          string
}

Methods

Add

go
func (agg *Webhook) Add(opts ) (error)

Remove

go
func (agg *Webhook) Remove(opts ) (error)

RemoveAttribute

go
func (agg *Webhook) RemoveAttribute(opts ) (error)

SetAttribute

go
func (agg *Webhook) SetAttribute(opts ) (error)

Update

go
func (agg *Webhook) Update(opts ) (error)

Event Handlers

WebhookReadmodel

Domain EventMethod
workspaceAggregate.WorkspaceCreatedEventWorkspaceCreatedEvent
workspaceAggregate.WorkspaceRemovedEventWorkspaceRemovedEvent
workspaceAggregate.WorkspaceUpdatedEventWorkspaceUpdatedEvent
aggregate.WebhookAddedEventWebhookAddedEvent
aggregate.WebhookUpdatedEventWebhookUpdatedEvent
aggregate.WebhookRemovedEventWebhookRemovedEvent
aggregate.WebhookAttributeSetEventWebhookAttributeSetEvent
aggregate.WebhookAttributeRemovedEventWebhookAttributeRemovedEvent
tenantAggregate.TenantCreatedEventTenantCreatedEvent
tenantAggregate.TenantRemovedEventTenantRemovedEvent
tenantAggregate.TenantUpdatedEventTenantUpdatedEvent

Workspace

Commands

WorkspaceCommandAddGroup

Domain Command Struct:

go
type WorkspaceCommandAddGroup struct {
	WorkspaceUuid string   `json:"workspaceUuid"`
	GroupUuid     string   `json:"groupUuid"`
	Name          string   `json:"name"`
	Permissions   []string `json:"permissions,omitempty"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WorkspaceCommandAddGroup(ctx context.Context, cmd comby.Command, domainCmd *WorkspaceCommandAddGroup) ([]comby.Event, error)

WorkspaceCommandAddMember

Domain Command Struct:

go
type WorkspaceCommandAddMember struct {
	WorkspaceUuid string   `json:"workspaceUuid"`
	IdentityUuid  string   `json:"identityUuid"`
	GroupUuids    []string `json:"groupUuids,omitempty"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WorkspaceCommandAddMember(ctx context.Context, cmd comby.Command, domainCmd *WorkspaceCommandAddMember) ([]comby.Event, error)

WorkspaceCommandAddWorkspaceMember

WorkspaceCommandAddWorkspaceMember adds another workspace as a member of this workspace. All identities in the member workspace will inherit access to this workspace with the assigned groups.

Domain Command Struct:

go
type WorkspaceCommandAddWorkspaceMember struct {
	WorkspaceUuid       string   `json:"workspaceUuid"`        // The workspace to add the member to
	MemberWorkspaceUuid string   `json:"memberWorkspaceUuid"`  // The workspace to add as member
	GroupUuids          []string `json:"groupUuids,omitempty"` // Groups to assign to the workspace member
}

Domain Command Handling Method:

go
func (cs *commandHandler) WorkspaceCommandAddWorkspaceMember(ctx context.Context, cmd comby.Command, domainCmd *WorkspaceCommandAddWorkspaceMember) ([]comby.Event, error)

WorkspaceCommandCreate

Domain Command Struct:

go
type WorkspaceCommandCreate struct {
	TenantUuid        string `json:"tenantUuid"`
	WorkspaceUuid     string `json:"workspaceUuid"`
	Name              string `json:"name"`
	Description       string `json:"description,omitempty"`
	OwnerIdentityUuid string `json:"ownerIdentityUuid"`
	Attributes        string `json:"attributes,omitempty"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WorkspaceCommandCreate(ctx context.Context, cmd comby.Command, domainCmd *WorkspaceCommandCreate) ([]comby.Event, error)

WorkspaceCommandRemove

Domain Command Struct:

go
type WorkspaceCommandRemove struct {
	WorkspaceUuid string `json:"workspaceUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WorkspaceCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *WorkspaceCommandRemove) ([]comby.Event, error)

WorkspaceCommandRemoveGroup

Domain Command Struct:

go
type WorkspaceCommandRemoveGroup struct {
	WorkspaceUuid string `json:"workspaceUuid"`
	GroupUuid     string `json:"groupUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WorkspaceCommandRemoveGroup(ctx context.Context, cmd comby.Command, domainCmd *WorkspaceCommandRemoveGroup) ([]comby.Event, error)

WorkspaceCommandRemoveMember

Domain Command Struct:

go
type WorkspaceCommandRemoveMember struct {
	WorkspaceUuid string `json:"workspaceUuid"`
	IdentityUuid  string `json:"identityUuid"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WorkspaceCommandRemoveMember(ctx context.Context, cmd comby.Command, domainCmd *WorkspaceCommandRemoveMember) ([]comby.Event, error)

WorkspaceCommandRemoveWorkspaceMember

WorkspaceCommandRemoveWorkspaceMember removes a workspace from the members of this workspace.

Domain Command Struct:

go
type WorkspaceCommandRemoveWorkspaceMember struct {
	WorkspaceUuid       string `json:"workspaceUuid"`       // The workspace to remove the member from
	MemberWorkspaceUuid string `json:"memberWorkspaceUuid"` // The workspace to remove as member
}

Domain Command Handling Method:

go
func (cs *commandHandler) WorkspaceCommandRemoveWorkspaceMember(ctx context.Context, cmd comby.Command, domainCmd *WorkspaceCommandRemoveWorkspaceMember) ([]comby.Event, error)

WorkspaceCommandUpdate

Domain Command Struct:

go
type WorkspaceCommandUpdate struct {
	WorkspaceUuid string   `json:"workspaceUuid"`
	Name          string   `json:"name,omitempty"`
	Description   string   `json:"description,omitempty"`
	Attributes    string   `json:"attributes,omitempty"`
	PatchedFields []string `json:"patchedFields" doc:"list of fields that should be patched - comma separated" example:"field1,field2"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WorkspaceCommandUpdate(ctx context.Context, cmd comby.Command, domainCmd *WorkspaceCommandUpdate) ([]comby.Event, error)

WorkspaceCommandUpdateGroup

Domain Command Struct:

go
type WorkspaceCommandUpdateGroup struct {
	WorkspaceUuid string   `json:"workspaceUuid"`
	GroupUuid     string   `json:"groupUuid"`
	Permissions   []string `json:"permissions"`
	PatchedFields []string `json:"patchedFields"`
}

Domain Command Handling Method:

go
func (cs *commandHandler) WorkspaceCommandUpdateGroup(ctx context.Context, cmd comby.Command, domainCmd *WorkspaceCommandUpdateGroup) ([]comby.Event, error)

Queries

Domain Query Structs:

Domain Query Responses:

WorkspaceQueryGet

Domain Query Struct:

go
type WorkspaceQueryGet struct {
	WorkspaceUuid  string `json:"workspaceUuid"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) WorkspaceQueryGet(ctx context.Context, qry comby.Query, domainQry *WorkspaceQueryGet) (*WorkspaceQueryItemResponse, error)

WorkspaceQueryList

Domain Query Struct:

go
type WorkspaceQueryList struct {
	TenantUuid     string `json:"tenantUuid"`
	Page           int64  `json:"page,omitempty"`
	PageSize       int64  `json:"pageSize,omitempty"`
	OrderBy        string `json:"orderBy,omitempty"`
	Attributes     string `json:"attributes,omitempty"`
	IncludeHistory bool   `json:"includeHistory,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) WorkspaceQueryList(ctx context.Context, qry comby.Query, domainQry *WorkspaceQueryList) (*WorkspaceQueryListResponse, error)

WorkspaceQueryListByIdentity

Domain Query Struct:

go
type WorkspaceQueryListByIdentity struct {
	TenantUuid   string `json:"tenantUuid"`
	IdentityUuid string `json:"identityUuid"`
	Page         int64  `json:"page,omitempty"`
	PageSize     int64  `json:"pageSize,omitempty"`
	OrderBy      string `json:"orderBy,omitempty"`
	Attributes   string `json:"attributes,omitempty"`
}

Domain Query Handling Method:

go
func (qs *queryHandler) WorkspaceQueryListByIdentity(ctx context.Context, qry comby.Query, domainQry *WorkspaceQueryListByIdentity) (*WorkspaceQueryListResponse, error)

WorkspaceQueryItemResponse

go
type WorkspaceQueryItemResponse struct {
	Item *readmodel.WorkspaceModel `json:"item,omitempty"`
}

WorkspaceQueryListResponse

go
type WorkspaceQueryListResponse struct {
	Items    []*readmodel.WorkspaceModel `json:"items,omitempty"`
	Total    int64                       `json:"total,omitempty"`
	Page     int64                       `json:"page,omitempty"`
	PageSize int64                       `json:"pageSize,omitempty"`
}

Events

WorkspaceGroupAddedEvent

Domain Event Struct:

go
type WorkspaceGroupAddedEvent struct {
	GroupUuid       string   `json:"groupUuid"`
	Name            string   `json:"name"`
	PermissionNames []string `json:"permissionNames"`
}

Domain Event Handling Method:

go
func (agg *Workspace) WorkspaceGroupAddedEvent(ctx context.Context, evt comby.Event, domainEvt *WorkspaceGroupAddedEvent) (error)

WorkspaceMemberAddedEvent

Domain Event Struct:

go
type WorkspaceMemberAddedEvent struct {
	IdentityUuid string   `json:"identityUuid"`
	GroupUuids   []string `json:"groupUuids"`
}

Domain Event Handling Method:

go
func (agg *Workspace) WorkspaceMemberAddedEvent(ctx context.Context, evt comby.Event, domainEvt *WorkspaceMemberAddedEvent) (error)

WorkspaceWorkspaceMemberAddedEvent

WorkspaceWorkspaceMemberAddedEvent is emitted when a workspace is added as a member to another workspace. This enables transitive membership: all identities in the member workspace gain access to this workspace.

Domain Event Struct:

go
type WorkspaceWorkspaceMemberAddedEvent struct {
	MemberWorkspaceUuid string   `json:"memberWorkspaceUuid"` // The workspace that becomes a member
	GroupUuids          []string `json:"groupUuids"`          // Groups assigned to this workspace member
}

Domain Event Handling Method: WorkspaceWorkspaceMemberAddedEvent handler applies the event to the aggregate state.

go
func (agg *Workspace) WorkspaceWorkspaceMemberAddedEvent(ctx context.Context, evt comby.Event, domainEvt *WorkspaceWorkspaceMemberAddedEvent) (error)

WorkspaceCreatedEvent

Domain Event Struct:

go
type WorkspaceCreatedEvent struct {
	TenantUuid        string `json:"tenantUuid"`
	Name              string `json:"name"`
	Description       string `json:"description,omitempty"`
	OwnerIdentityUuid string `json:"ownerIdentityUuid"`
	Attributes        string `json:"attributes,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Workspace) WorkspaceCreatedEvent(ctx context.Context, evt comby.Event, domainEvt *WorkspaceCreatedEvent) (error)

WorkspaceRemovedEvent

Domain Event Struct:

go
type WorkspaceRemovedEvent struct {
	Reason string `json:"reason,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Workspace) WorkspaceRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *WorkspaceRemovedEvent) (error)

WorkspaceGroupRemovedEvent

Domain Event Struct:

go
type WorkspaceGroupRemovedEvent struct {
	GroupUuid string `json:"groupUuid"`
}

Domain Event Handling Method:

go
func (agg *Workspace) WorkspaceGroupRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *WorkspaceGroupRemovedEvent) (error)

WorkspaceMemberRemovedEvent

Domain Event Struct:

go
type WorkspaceMemberRemovedEvent struct {
	IdentityUuid string `json:"identityUuid"`
}

Domain Event Handling Method:

go
func (agg *Workspace) WorkspaceMemberRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *WorkspaceMemberRemovedEvent) (error)

WorkspaceWorkspaceMemberRemovedEvent

WorkspaceWorkspaceMemberRemovedEvent is emitted when a workspace is removed as a member from another workspace.

Domain Event Struct:

go
type WorkspaceWorkspaceMemberRemovedEvent struct {
	MemberWorkspaceUuid string `json:"memberWorkspaceUuid"` // The workspace that is removed as member
}

Domain Event Handling Method: WorkspaceWorkspaceMemberRemovedEvent handler applies the event to the aggregate state.

go
func (agg *Workspace) WorkspaceWorkspaceMemberRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *WorkspaceWorkspaceMemberRemovedEvent) (error)

WorkspaceUpdatedEvent

Domain Event Struct:

go
type WorkspaceUpdatedEvent struct {
	Name          string   `json:"name,omitempty"`
	Description   string   `json:"description,omitempty"`
	Attributes    string   `json:"attributes,omitempty"`
	PatchedFields []string `json:"patchedFields,omitempty"`
}

Domain Event Handling Method:

go
func (agg *Workspace) WorkspaceUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *WorkspaceUpdatedEvent) (error)

WorkspaceGroupUpdatedEvent

Domain Event Struct:

go
type WorkspaceGroupUpdatedEvent struct {
	GroupUuid       string   `json:"groupUuid"`
	PermissionNames []string `json:"permissionNames"`
}

Domain Event Handling Method:

go
func (agg *Workspace) WorkspaceGroupUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *WorkspaceGroupUpdatedEvent) (error)

Aggregate

Aggregate Struct:

go
type Workspace struct {
	*comby.BaseAggregate
	// References
	TenantUuid string
	// Entities
	Groups           []*WorkspaceGroup           // Workspace groups with permissions
	Members          []*WorkspaceMember          // Identity members
	MemberWorkspaces []*WorkspaceMemberWorkspace // Workspace members (transitive membership)
	// Value Objects
	Name              string
	Description       string
	OwnerIdentityUuid string
}

Methods

AddGroup

go
func (agg *Workspace) AddGroup(opts ) (error)

AddMember

go
func (agg *Workspace) AddMember(opts ) (error)

AddWorkspaceMember

AddWorkspaceMember adds another workspace as a member of this workspace. All identities in the member workspace will inherit access to this workspace with the assigned groups.

go
func (agg *Workspace) AddWorkspaceMember(opts ) (error)

Create

go
func (agg *Workspace) Create(opts ) (error)

Remove

go
func (agg *Workspace) Remove(opts ) (error)

RemoveGroup

go
func (agg *Workspace) RemoveGroup(opts ) (error)

RemoveMember

go
func (agg *Workspace) RemoveMember(opts ) (error)

RemoveWorkspaceMember

RemoveWorkspaceMember removes a workspace from the members of this workspace.

go
func (agg *Workspace) RemoveWorkspaceMember(opts ) (error)

Update

go
func (agg *Workspace) Update(opts ) (error)

UpdateGroup

go
func (agg *Workspace) UpdateGroup(opts ) (error)

Event Handlers

WorkspaceReadmodel

Domain EventMethod
aggregate.WorkspaceCreatedEventWorkspaceCreatedEvent
aggregate.WorkspaceUpdatedEventWorkspaceUpdatedEvent
aggregate.WorkspaceRemovedEventWorkspaceRemovedEvent
aggregate.WorkspaceMemberAddedEventWorkspaceMemberAddedEvent
aggregate.WorkspaceMemberRemovedEventWorkspaceMemberRemovedEvent
aggregate.WorkspaceGroupAddedEventWorkspaceGroupAddedEvent
aggregate.WorkspaceGroupUpdatedEventWorkspaceGroupUpdatedEvent
aggregate.WorkspaceGroupRemovedEventWorkspaceGroupRemovedEvent
aggregate.WorkspaceWorkspaceMemberAddedEventWorkspaceWorkspaceMemberAddedEvent
aggregate.WorkspaceWorkspaceMemberRemovedEventWorkspaceWorkspaceMemberRemovedEvent

Custom Permissions

NameTypeComment
WorkspaceQueryListByIdentityQueryList workspaces by identityUuid