Account
Commands
- AccountCommandActivate
- AccountCommandChangePassword
- AccountCommandConfirmPasswordReset
- AccountCommandConfirmRegister
- AccountCommandCreate
- AccountCommandLogin
- AccountCommandLoginOAuth
- AccountCommandLoginOpaque
- AccountCommandLogout
- AccountCommandRegister
- AccountCommandRegisterOpaque
- AccountCommandRemove
- AccountCommandRemoveAttribute
- AccountCommandRequestPasswordReset
- AccountCommandSetAttribute
- AccountCommandUpdate
- AccountCommandUpdateCredentials
- AccountCommandUpdateCredentialsOpaque
- AccountCommandUpdateState
AccountCommandActivate
AccountCommandActivate is a domain command to activate an account.
Domain Command Struct:
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)
func (ch *commandHandler) AccountCommandActivate(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandActivate) ([]comby.Event, error)
AccountCommandChangePassword
Domain Command Struct:
type AccountCommandChangePassword struct {
Email string `json:"email"`
PasswordCurrent string `json:"passwordCurrent"`
NewPassword string `json:"newPassword"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandChangePassword(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandChangePassword) ([]comby.Event, error)
AccountCommandConfirmPasswordReset
Domain Command Struct:
type AccountCommandConfirmPasswordReset struct {
OneTimeToken string `json:"oneTimeToken"`
NewPassword string `json:"newPassword"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandConfirmPasswordReset(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandConfirmPasswordReset) ([]comby.Event, error)
AccountCommandConfirmRegister
Domain Command Struct:
type AccountCommandConfirmRegister struct {
OneTimeToken string `json:"oneTimeToken"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandConfirmRegister(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandConfirmRegister) ([]comby.Event, error)
AccountCommandCreate
Domain Command Struct:
type AccountCommandCreate struct {
AccountUuid string `json:"accountUuid"`
Email string `json:"email,omitempty"`
Password string `json:"password,omitempty"`
Type string `json:"type,omitempty"` // default: emailPassword (available: emailPassword, opaque)
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandCreate(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandCreate) ([]comby.Event, error)
AccountCommandLogin
Domain Command Struct:
type AccountCommandLogin struct {
Email string `json:"email"`
Password string `json:"password"`
SessionUuid string `json:"sessionUuid"`
SessionKey string `json:"sessionKey"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandLogin(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandLogin) ([]comby.Event, error)
AccountCommandLoginOAuth
Domain Command Struct:
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:
func (ch *commandHandler) AccountCommandLoginOAuth(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandLoginOAuth) ([]comby.Event, error)
AccountCommandLoginOpaque
AccountCommandLoginOpaque represents OPAQUE login command
Domain Command Struct:
type AccountCommandLoginOpaque struct {
Email string `json:"email"`
SessionUuid string `json:"sessionUuid"`
SessionKey string `json:"sessionKey"`
SessionData []byte `json:"sessionData"` // OPAQUE session key data
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandLoginOpaque(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandLoginOpaque) ([]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:
- 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.
- 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:
type AccountCommandLogout struct {
AccountUuid string `json:"accountUuid,omitempty"`
SessionUuid string `json:"sessionUuid,omitempty"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandLogout(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandLogout) ([]comby.Event, error)
AccountCommandRegister
Domain Command Struct:
type AccountCommandRegister struct {
AccountUuid string `json:"accountUuid"`
Email string `json:"email"`
Password string `json:"password"`
InvitationToken string `json:"invitationToken,omitempty"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandRegister(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandRegister) ([]comby.Event, error)
AccountCommandRegisterOpaque
Domain Command Struct:
type AccountCommandRegisterOpaque struct {
AccountUuid string `json:"accountUuid"`
Email string `json:"email"`
OpaqueCredentialRecord *opaque.OpaqueCredentialRecord `json:"opaqueCredentialRecord"`
InvitationToken string `json:"invitationToken,omitempty"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandRegisterOpaque(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandRegisterOpaque) ([]comby.Event, error)
AccountCommandRemove
AccountCommandRemove handles the deletion of accounts, with strict rules to ensure proper access control.
This command enforces the following restrictions:
- Self-Deletion Prohibited:
- A user cannot delete their own account under any circumstances. This ensures a safeguard against accidental or unauthorized self-deletion.
- 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:
type AccountCommandRemove struct {
AccountUuid string `json:"accountUuid"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandRemove) ([]comby.Event, error)
AccountCommandRemoveAttribute
Domain Command Struct:
type AccountCommandRemoveAttribute struct {
AccountUuid string `json:"accountUuid"`
Key string `json:"key"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandRemoveAttribute) ([]comby.Event, error)
AccountCommandRequestPasswordReset
Domain Command Struct:
type AccountCommandRequestPasswordReset struct {
Email string `json:"email"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandRequestPasswordReset(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandRequestPasswordReset) ([]comby.Event, error)
AccountCommandSetAttribute
Domain Command Struct:
type AccountCommandSetAttribute struct {
AccountUuid string `json:"accountUuid"`
Key string `json:"key"`
Value any `json:"value"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandSetAttribute) ([]comby.Event, error)
AccountCommandUpdate
Domain Command Struct:
type AccountCommandUpdate struct {
AccountUuid string `json:"accountUuid"`
Attributes string `json:"attributes,omitempty"`
PatchedFields []string `json:"patchedFields"`
}
Domain Command Handling Method:
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:
- 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.
- 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:
type AccountCommandUpdateCredentials struct {
AccountUuid string `json:"accountUuid"`
Email string `json:"email"`
Password string `json:"password"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandUpdateCredentials(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandUpdateCredentials) ([]comby.Event, error)
AccountCommandUpdateCredentialsOpaque
Domain Command Struct:
type AccountCommandUpdateCredentialsOpaque struct {
Email string `json:"email"`
PasswordResetToken string `json:"passwordResetToken"`
OpaqueCredentialRecord *opaque.OpaqueCredentialRecord `json:"opaqueCredentialRecord"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandUpdateCredentialsOpaque(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandUpdateCredentialsOpaque) ([]comby.Event, error)
AccountCommandUpdateState
Domain Command Struct:
type AccountCommandUpdateState struct {
AccountUuid string `json:"accountUuid"`
State string `json:"state"`
}
Domain Command Handling Method:
func (ch *commandHandler) AccountCommandUpdateState(ctx context.Context, cmd comby.Command, domainCmd *AccountCommandUpdateState) ([]comby.Event, error)
Queries
Domain Query Structs:
- AccountQueryList
- AccountQueryModelByEmail
- AccountQueryModelEmailPassword
- AccountQueryModel
- AccountQueryModelOneTimeToken
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:
- 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.
- 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.
- 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:
type AccountQueryList struct {
Page int64 `json:"page,omitempty"`
PageSize int64 `json:"pageSize,omitempty"`
OrderBy string `json:"orderBy,omitempty"`
Attributes string `json:"attributes,omitempty"`
}
Domain Query Handling Method:
func (qh *queryHandler) AccountQueryList(ctx context.Context, qry comby.Query, domainQry *AccountQueryList) (*AccountQueryListResponse, error)
AccountQueryModelByEmail
Domain Query Struct:
type AccountQueryModelByEmail struct {
Email string `json:"email"`
}
Domain Query Handling Method:
func (qh *queryHandler) AccountQueryModelByEmail(ctx context.Context, qry comby.Query, domainQry *AccountQueryModelByEmail) (*AccountQueryItemResponse, error)
AccountQueryModelEmailPassword
Domain Query Struct:
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:
func (qh *queryHandler) AccountQueryModelEmailPassword(ctx context.Context, qry comby.Query, domainQry *AccountQueryModelEmailPassword) (*AccountQueryItemResponse, error)
AccountQueryModel
Domain Query Struct:
type AccountQueryModel struct {
AccountUuid string `json:"accountUuid"`
}
Domain Query Handling Method:
func (qh *queryHandler) AccountQueryModel(ctx context.Context, qry comby.Query, domainQry *AccountQueryModel) (*AccountQueryItemResponse, error)
AccountQueryModelOneTimeToken
Domain Query Struct:
type AccountQueryModelOneTimeToken struct {
OneTimeToken string `json:"ott"`
}
Domain Query Handling Method:
func (qh *queryHandler) AccountQueryModelOneTimeToken(ctx context.Context, qry comby.Query, domainQry *AccountQueryModelOneTimeToken) (*AccountQueryItemResponse, error)
AccountQueryListResponse
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
type AccountQueryItemResponse struct {
Item *readmodel.AccountModel `json:"item,omitempty"`
}
Events
- AccountPasswordChangedEvent
- AccountPasswordResetConfirmedEvent
- AccountRegisterConfirmedEvent
- AccountLoggedInEvent
- AccountLoggedInOpaqueEvent
- AccountLoggedOutEvent
- AccountRegisteredEvent
- AccountRegisteredOpaqueEvent
- AccountRemovedEvent
- AccountAttributeRemovedEvent
- AccountPasswordResetRequestedEvent
- AccountPasswordResetOpaqueRequestedEvent
- AccountAttributeSetEvent
- AccountUpdatedEvent
- AccountCredentialsUpdatedEvent
- AccountCredentialsOpaqueUpdatedEvent
- AccountOneTimeTokenUpdatedEvent
- AccountStateUpdatedEvent
AccountPasswordChangedEvent
AccountPasswordChangedEvent is an domain event that is triggered when the password of an account has changed.
Domain Event Struct:
type AccountPasswordChangedEvent struct {
NewHashedPassword string `json:"newHashedPassword"` // The new hashed password for the account.
}
Domain Event Handling Method:
func (agg *Account) AccountPasswordChangedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountPasswordChangedEvent) (error)
AccountPasswordResetConfirmedEvent
Domain Event Struct:
type AccountPasswordResetConfirmedEvent struct {
NewHashedPassword string `json:"newHashedPassword"`
State string `json:"state"`
}
Domain Event Handling Method:
func (agg *Account) AccountPasswordResetConfirmedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountPasswordResetConfirmedEvent) (error)
AccountRegisterConfirmedEvent
Domain Event Struct:
type AccountRegisterConfirmedEvent struct {
State string `json:"state"`
}
Domain Event Handling Method:
func (agg *Account) AccountRegisterConfirmedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountRegisterConfirmedEvent) (error)
AccountLoggedInEvent
Domain Event Struct:
type AccountLoggedInEvent struct {
SessionUuid string `json:"sessionUuid"`
SessionKey string `json:"sessionKey"`
ExpiredAt int64 `json:"expiredAt"`
}
Domain Event Handling Method:
func (agg *Account) AccountLoggedInEvent(ctx context.Context, evt comby.Event, domainEvt *AccountLoggedInEvent) (error)
AccountLoggedInOpaqueEvent
Events for OPAQUE operations
Domain Event Struct:
type AccountLoggedInOpaqueEvent struct {
Email string `json:"email"`
SessionUuid string `json:"sessionUuid"`
SessionKey string `json:"sessionKey"`
ExpiredAt int64 `json:"expiredAt"`
Success bool `json:"success"`
}
Domain Event Handling Method: Event handler for OPAQUE login
func (agg *Account) AccountLoggedInOpaqueEvent(ctx context.Context, evt comby.Event, domainEvt *AccountLoggedInOpaqueEvent) (error)
AccountLoggedOutEvent
Domain Event Struct:
type AccountLoggedOutEvent struct {
SessionUuid string `json:"sessionUuid"`
}
Domain Event Handling Method:
func (agg *Account) AccountLoggedOutEvent(ctx context.Context, evt comby.Event, domainEvt *AccountLoggedOutEvent) (error)
AccountRegisteredEvent
Domain Event Struct:
type AccountRegisteredEvent struct {
State string `json:"state,omitempty"`
}
Domain Event Handling Method:
func (agg *Account) AccountRegisteredEvent(ctx context.Context, evt comby.Event, domainEvt *AccountRegisteredEvent) (error)
AccountRegisteredOpaqueEvent
Domain Event Struct:
type AccountRegisteredOpaqueEvent struct {
State string `json:"state,omitempty"`
Email string `json:"email,omitempty"`
OpaqueCredentialRecord *opaque.OpaqueCredentialRecord `json:"opaqueCredentialRecord,omitempty"`
}
Domain Event Handling Method:
func (agg *Account) AccountRegisteredOpaqueEvent(ctx context.Context, evt comby.Event, domainEvt *AccountRegisteredOpaqueEvent) (error)
AccountRemovedEvent
Domain Event Struct:
type AccountRemovedEvent struct {
State string `json:"state,omitempty"`
}
Domain Event Handling Method:
func (agg *Account) AccountRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountRemovedEvent) (error)
AccountAttributeRemovedEvent
Domain Event Struct:
type AccountAttributeRemovedEvent struct {
Key string `json:"key"`
}
Domain Event Handling Method:
func (agg *Account) AccountAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountAttributeRemovedEvent) (error)
AccountPasswordResetRequestedEvent
Domain Event Struct:
type AccountPasswordResetRequestedEvent struct {
Email string `json:"email"`
Code string `json:"code"`
}
Domain Event Handling Method:
func (agg *Account) AccountPasswordResetRequestedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountPasswordResetRequestedEvent) (error)
AccountPasswordResetOpaqueRequestedEvent
Domain Event Struct:
type AccountPasswordResetOpaqueRequestedEvent struct {
Email string `json:"email"`
Code string `json:"code"`
}
Domain Event Handling Method:
func (agg *Account) AccountPasswordResetOpaqueRequestedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountPasswordResetOpaqueRequestedEvent) (error)
AccountAttributeSetEvent
Domain Event Struct:
type AccountAttributeSetEvent struct {
Key string `json:"key"`
Value any `json:"value"`
}
Domain Event Handling Method:
func (agg *Account) AccountAttributeSetEvent(ctx context.Context, evt comby.Event, domainEvt *AccountAttributeSetEvent) (error)
AccountUpdatedEvent
Domain Event Struct:
type AccountUpdatedEvent struct {
Attributes string `json:"attributes,omitempty"`
}
Domain Event Handling Method:
func (agg *Account) AccountUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountUpdatedEvent) (error)
AccountCredentialsUpdatedEvent
Domain Event Struct:
type AccountCredentialsUpdatedEvent struct {
Email string `json:"email,omitempty"`
Password string `json:"password,omitempty"`
}
Domain Event Handling Method:
func (agg *Account) AccountCredentialsUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountCredentialsUpdatedEvent) (error)
AccountCredentialsOpaqueUpdatedEvent
Domain Event Struct:
type AccountCredentialsOpaqueUpdatedEvent struct {
Email string `json:"email"`
OpaqueCredentialRecord *opaque.OpaqueCredentialRecord `json:"opaqueCredentialRecord"`
}
Domain Event Handling Method:
func (agg *Account) AccountCredentialsOpaqueUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountCredentialsOpaqueUpdatedEvent) (error)
AccountOneTimeTokenUpdatedEvent
Domain Event Struct:
type AccountOneTimeTokenUpdatedEvent struct {
Key string `json:"key"`
ExpiredAt int64 `json:"expiredAt"`
}
Domain Event Handling Method:
func (agg *Account) AccountOneTimeTokenUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *AccountOneTimeTokenUpdatedEvent) (error)
AccountStateUpdatedEvent
Domain Event Struct:
type AccountStateUpdatedEvent struct {
State string `json:"state"`
}
Domain Event Handling Method:
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.
- OneTimeToken: Single-use tokens with attributes for the key, type, and expiration time.
- Session: Details about active user sessions, including a unique session UUID, session key, and expiration time.
Aggregate Struct:
type Account struct {
*comby.BaseAggregate
// Entities
Credentials *Credentials
CredentialsOpaque *CredentialsOpaque
OneTimeToken *OneTimeToken
Sessions []*Session
// Value Objects
State string
}
Methods
- ChangePassword
- ConfirmPasswordReset
- ConfirmRegister
- Login
- LoginWithOpaque
- Logout
- LogoutSession
- Register
- RegisterWithOPAQUE
- Remove
- RemoveAttribute
- RequestPasswordReset
- RequestPasswordResetOpaque
- SetAttribute
- Update
- UpdateCredentials
- UpdateCredentialsOpaque
- UpdateOneTimeToken
- UpdateState
ChangePassword
func (agg *Account) ChangePassword(passwordCurrent, newPassword string) (error)
ConfirmPasswordReset
func (agg *Account) ConfirmPasswordReset(oneTimeToken, newPassword string) (error)
ConfirmRegister
func (agg *Account) ConfirmRegister(oneTimeToken string) (error)
Login
func (agg *Account) Login(email, password, sessionUuid, sessionKey string) (error)
LoginWithOpaque
LoginWithOpaque handles OPAQUE-based authentication
func (agg *Account) LoginWithOpaque(email, sessionUuid, sessionKey string, sessionData []byte) (error)
Logout
func (agg *Account) Logout() (error)
LogoutSession
func (agg *Account) LogoutSession(sessionUuid string) (error)
Register
func (agg *Account) Register(email, password, state string) (error)
RegisterWithOPAQUE
RegisterWithOPAQUE registers an account using OPAQUE credentials
func (agg *Account) RegisterWithOPAQUE(email, state string, credentialRecord *opaque.OpaqueCredentialRecord) (error)
Remove
func (agg *Account) Remove() (error)
RemoveAttribute
func (agg *Account) RemoveAttribute(key string) (error)
RequestPasswordReset
func (agg *Account) RequestPasswordReset(email string) (error)
RequestPasswordResetOpaque
func (agg *Account) RequestPasswordResetOpaque(email string) (error)
SetAttribute
func (agg *Account) SetAttribute(key string, value any) (error)
Update
func (agg *Account) Update(attributes string) (error)
UpdateCredentials
func (agg *Account) UpdateCredentials(email, password string) (error)
UpdateCredentialsOpaque
func (agg *Account) UpdateCredentialsOpaque(email string, opaqueCredentialRecord *opaque.OpaqueCredentialRecord) (error)
UpdateOneTimeToken
func (agg *Account) UpdateOneTimeToken(key string, expiredAt int64) (error)
UpdateState
func (agg *Account) UpdateState(state string) (error)
Event Handlers
Reactor
Domain Event | Method |
---|---|
aggregate.AccountRegisteredEvent | AccountRegisteredEvent |
aggregate.AccountPasswordResetRequestedEvent | AccountPasswordResetRequestedEvent |
AccountReadmodel
Domain Event | Method |
---|---|
tenantAggregate.TenantAttributeRemovedEvent | TenantAttributeRemovedEvent |
tenantAggregate.TenantAttributeSetEvent | TenantAttributeSetEvent |
tenantAggregate.TenantUpdatedEvent | TenantUpdatedEvent |
tenantAggregate.TenantRemovedEvent | TenantRemovedEvent |
tenantAggregate.TenantCreatedEvent | TenantCreatedEvent |
identityAggregate.IdentityRemovedEvent | IdentityRemovedEvent |
identityAggregate.IdentityProfileUpdatedEvent | IdentityProfileUpdatedEvent |
identityAggregate.IdentityAddedGroupEvent | IdentityAddedGroupEvent |
identityAggregate.IdentityCreatedEvent | IdentityCreatedEvent |
groupAggregate.GroupAddedEvent | GroupAddedEvent |
groupAggregate.GroupRemovedEvent | GroupRemovedEvent |
groupAggregate.GroupUpdatedEvent | GroupUpdatedEvent |
accountAggregate.AccountCredentialsOpaqueUpdatedEvent | AccountCredentialsOpaqueUpdatedEvent |
accountAggregate.AccountOneTimeTokenUpdatedEvent | AccountOneTimeTokenUpdatedEvent |
accountAggregate.AccountStateUpdatedEvent | AccountStateUpdatedEvent |
accountAggregate.AccountRegisteredOpaqueEvent | AccountRegisteredOpaqueEvent |
accountAggregate.AccountLoggedInOpaqueEvent | AccountLoggedInOpaqueEvent |
accountAggregate.AccountAttributeRemovedEvent | AccountAttributeRemovedEvent |
accountAggregate.AccountAttributeSetEvent | AccountAttributeSetEvent |
accountAggregate.AccountLoggedOutEvent | AccountLoggedOutEvent |
accountAggregate.AccountLoggedInEvent | AccountLoggedInEvent |
accountAggregate.AccountUpdatedEvent | AccountUpdatedEvent |
accountAggregate.AccountRegisteredEvent | AccountRegisteredEvent |
accountAggregate.AccountCredentialsUpdatedEvent | AccountCredentialsUpdatedEvent |
accountAggregate.AccountRemovedEvent | AccountRemovedEvent |
accountAggregate.AccountPasswordResetConfirmedEvent | AccountPasswordResetConfirmedEvent |
accountAggregate.AccountPasswordResetRequestedEvent | AccountPasswordResetRequestedEvent |
accountAggregate.AccountPasswordChangedEvent | AccountPasswordChangedEvent |
accountAggregate.AccountRegisterConfirmedEvent | AccountRegisterConfirmedEvent |
Custom Permissions
Name | Type | Comment |
---|---|---|
AccountCommandActivate | Command | Activate an existing account |
AccountCommandChangePassword | Command | Change password of an existing account |
AccountCommandRequestPasswordReset | Command | Request password reset of an existing account |
AccountCommandConfirmPasswordReset | Command | Confirm password reset of an existing account |
AccountCommandConfirmRegister | Command | Confirm registration of an new account |
AccountCommandCreate | Command | Create new account manually |
AccountCommandLoginOAuth | Command | Login into an existing account using OAuth |
AccountCommandLogin | Command | Login into an existing account |
AccountCommandLogout | Command | Logout an account |
AccountCommandRegister | Command | Register new account |
AccountCommandRemove | Command | Remove existing account |
AccountCommandUpdateCredentials | Command | Update credentials of an existing account |
AccountCommandUpdate | Command | Update account |
AccountCommandSetAttribute | Command | Set single attribute of an existing account |
AccountCommandRemoveAttribute | Command | Remove single attribute of an existing account |
AccountCommandUpdateState | Command | Update state of an existing account |
AccountCommandRegisterOpaque | Command | Register a new account (OPAQUE) |
AccountCommandLoginOpaque | Command | Login to an existing account (OPAQUE) |
AccountQueryModelOneTimeToken | Query | Request account details by one time password |
AccountQueryModelEmailPassword | Query | Request account details by email and password |
AccountQueryModel | Query | Request account details |
Asset
Commands
- AssetCommandAdd
- AssetCommandRemove
- AssetCommandRemoveAttribute
- AssetCommandSetAttribute
- AssetCommandUpdate
AssetCommandAdd
Domain Command Struct:
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"`
Attributes string `json:"attributes,omitempty"`
}
Domain Command Handling Method:
func (cs *commandHandler) AssetCommandAdd(ctx context.Context, cmd comby.Command, domainCmd *AssetCommandAdd) ([]comby.Event, error)
AssetCommandRemove
Domain Command Struct:
type AssetCommandRemove struct {
AssetUuid string `json:"assetUuid"`
}
Domain Command Handling Method:
func (cs *commandHandler) AssetCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *AssetCommandRemove) ([]comby.Event, error)
AssetCommandRemoveAttribute
Domain Command Struct:
type AssetCommandRemoveAttribute struct {
AssetUuid string `json:"assetUuid"`
Key string `json:"key"`
}
Domain Command Handling Method:
func (cs *commandHandler) AssetCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *AssetCommandRemoveAttribute) ([]comby.Event, error)
AssetCommandSetAttribute
Domain Command Struct:
type AssetCommandSetAttribute struct {
AssetUuid string `json:"assetUuid"`
Key string `json:"key"`
Value any `json:"value"`
}
Domain Command Handling Method:
func (cs *commandHandler) AssetCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *AssetCommandSetAttribute) ([]comby.Event, error)
AssetCommandUpdate
Domain Command Struct:
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:
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:
type AssetQueryDownload struct {
AssetUuid string `json:"assetUuid"`
}
Domain Query Handling Method:
func (qs *queryHandler) AssetQueryDownload(ctx context.Context, qry comby.Query, domainQry *AssetQueryDownload) (*AssetQueryItemResponse, error)
AssetQueryList
Domain Query Struct:
type AssetQueryList 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"`
}
Domain Query Handling Method:
func (qs *queryHandler) AssetQueryList(ctx context.Context, qry comby.Query, domainQry *AssetQueryList) (*AssetQueryListResponse, error)
AssetQueryModelByBucketObject
Domain Query Struct:
type AssetQueryModelByBucketObject struct {
BucketName string `json:"bucketName"`
ObjectName string `json:"objectName"`
}
Domain Query Handling Method:
func (qs *queryHandler) AssetQueryModelByBucketObject(ctx context.Context, qry comby.Query, domainQry *AssetQueryModelByBucketObject) (*AssetQueryItemResponse, error)
AssetQueryModel
Domain Query Struct:
type AssetQueryModel struct {
AssetUuid string `json:"assetUuid"`
}
Domain Query Handling Method:
func (qs *queryHandler) AssetQueryModel(ctx context.Context, qry comby.Query, domainQry *AssetQueryModel) (*AssetQueryItemResponse, error)
AssetQueryItemResponse
type AssetQueryItemResponse struct {
Item *readmodel.AssetModel `json:"item,omitempty"`
}
AssetQueryListResponse
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:
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"`
Attributes string `json:"attributes,omitempty"`
}
Domain Event Handling Method:
func (agg *Asset) AssetAddedEvent(ctx context.Context, evt comby.Event, domainEvt *AssetAddedEvent) (error)
AssetRemovedEvent
Domain Event Struct:
type AssetRemovedEvent struct {
Reason string `json:"reason,omitempty"`
}
Domain Event Handling Method:
func (agg *Asset) AssetRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *AssetRemovedEvent) (error)
AssetAttributeRemovedEvent
Domain Event Struct:
type AssetAttributeRemovedEvent struct {
Key string `json:"key"`
}
Domain Event Handling Method:
func (agg *Asset) AssetAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *AssetAttributeRemovedEvent) (error)
AssetAttributeSetEvent
Domain Event Struct:
type AssetAttributeSetEvent struct {
Key string `json:"key"`
Value any `json:"value"`
}
Domain Event Handling Method:
func (agg *Asset) AssetAttributeSetEvent(ctx context.Context, evt comby.Event, domainEvt *AssetAttributeSetEvent) (error)
AssetUpdatedEvent
Domain Event Struct:
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:
func (agg *Asset) AssetUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *AssetUpdatedEvent) (error)
Aggregate
Aggregate Struct:
type Asset struct {
*comby.BaseAggregate
// References
IdentityUuid string
// Value Objects (asset)
Name string
Size int64
ContentType string
Path string
// Value Objects (storage)
BucketName string
ObjectName string
}
Methods
Add
func (agg *Asset) Add(identityUuid, assetName string, assetSize int64, assetContentType, bucketName, objectName, attributes string) (error)
Remove
func (agg *Asset) Remove() (error)
RemoveAttribute
func (agg *Asset) RemoveAttribute(key string) (error)
SetAttribute
func (agg *Asset) SetAttribute(key string, value any) (error)
Update
func (agg *Asset) Update(identityUuid, assetName string, assetSize int64, assetContentType, bucketName, objectName, attributes string) (error)
Event Handlers
AssetReadmodel
Domain Event | Method |
---|---|
tenantAggregate.TenantCreatedEvent | TenantCreatedEvent |
tenantAggregate.TenantRemovedEvent | TenantRemovedEvent |
tenantAggregate.TenantUpdatedEvent | TenantUpdatedEvent |
identityAggregate.IdentityCreatedEvent | IdentityCreatedEvent |
identityAggregate.IdentityProfileUpdatedEvent | IdentityProfileUpdatedEvent |
identityAggregate.IdentityRemovedEvent | IdentityRemovedEvent |
assetAggregate.AssetAddedEvent | AssetAddedEvent |
assetAggregate.AssetUpdatedEvent | AssetUpdatedEvent |
assetAggregate.AssetRemovedEvent | AssetRemovedEvent |
assetAggregate.AssetAttributeSetEvent | AssetAttributeSetEvent |
assetAggregate.AssetAttributeRemovedEvent | AssetAttributeRemovedEvent |
Custom Permissions
Name | Type | Comment |
---|---|---|
AssetCommandAdd | Command | Create and upload asset |
AssetCommandRemove | Command | Remove existing asset |
AssetCommandUpdate | Command | Update existing asset |
AssetCommandSetAttribute | Command | Set single attribute for existing asset |
AssetCommandRemoveAttribute | Command | Remove single attribute from existing asset |
AssetQueryDownload | Query | Download existing asset |
AssetQueryList | Query | List all assets |
AssetQueryModel | Query | Get asset |
AssetQueryModelByBucketObject | Query | Get asset by bucket and object name |
Auth
Commands
CommandWithoutTargetAggregate
Domain Command Struct:
type CommandWithoutTargetAggregate struct {
NewAggAUuid string `json:"newAggAUuid"`
Name string
}
Domain Command Handling Method:
func (cs *commandHandler) CommandHandlerWithoutTargetAggregateUuid(ctx context.Context, cmd comby.Command, domainCmd *CommandWithoutTargetAggregate) ([]comby.Event, error)
CommandWithTargetAggregate
Domain Command Struct:
type CommandWithTargetAggregate struct {
AggAUuid string `json:"aggAUuid"`
Name string
}
Domain Command Handling Method:
func (cs *commandHandler) CommandHandlerWithTargetAggregateUuid(ctx context.Context, cmd comby.Command, domainCmd *CommandWithTargetAggregate) ([]comby.Event, error)
Events
AggACreated
Domain Event Struct:
type AggACreated struct {
AggAUuid string `json:"aggAUuid"`
Other string `json:"other,omitempty"`
}
Domain Event Handling Method:
func (agg *AggA) AggACreated(ctx context.Context, evt comby.Event, domainEvt *AggACreated) (error)
AggAModified
Domain Event Struct:
type AggAModified struct {
AggAUuid string `json:"aggAUuid"`
Other string `json:"other,omitempty"`
}
Domain Event Handling Method:
func (agg *AggA) AggAModified(ctx context.Context, evt comby.Event, domainEvt *AggAModified) (error)
Aggregate
Aggregate Struct:
type AggA struct {
*comby.BaseAggregate
Other string
}
Methods
CreateAggA
func (agg *AggA) CreateAggA(other string) (error)
ModifyAggA
func (agg *AggA) ModifyAggA(other string) (error)
Event Handlers
AccountCtxReadmodel
Domain Event | Method |
---|---|
tenantAggregate.TenantRemovedEvent | TenantRemovedEvent |
tenantAggregate.TenantCreatedEvent | TenantCreatedEvent |
identityAggregate.IdentityRemovedGroupEvent | IdentityRemovedGroupEvent |
identityAggregate.IdentityAddedGroupEvent | IdentityAddedGroupEvent |
identityAggregate.IdentityRemovedTokenEvent | IdentityRemovedTokenEvent |
identityAggregate.IdentityAddedTokenEvent | IdentityAddedTokenEvent |
identityAggregate.IdentityRemovedEvent | IdentityRemovedEvent |
identityAggregate.IdentityCreatedEvent | IdentityCreatedEvent |
groupAggregate.GroupAddedEvent | GroupAddedEvent |
groupAggregate.GroupUpdatedEvent | GroupUpdatedEvent |
groupAggregate.GroupRemovedEvent | GroupRemovedEvent |
accountAggregate.AccountCredentialsUpdatedEvent | AccountCredentialsUpdatedEvent |
accountAggregate.AccountRegisteredEvent | AccountRegisteredEvent |
accountAggregate.AccountAttributeSetEvent | AccountAttributeSetEvent |
accountAggregate.AccountLoggedOutEvent | AccountLoggedOutEvent |
accountAggregate.AccountLoggedInOpaqueEvent | AccountLoggedInOpaqueEvent |
accountAggregate.AccountLoggedInEvent | AccountLoggedInEvent |
accountAggregate.AccountOneTimeTokenUpdatedEvent | AccountOneTimeTokenUpdatedEvent |
accountAggregate.AccountAttributeRemovedEvent | AccountAttributeRemovedEvent |
accountAggregate.AccountRemovedEvent | AccountRemovedEvent |
accountAggregate.AccountPasswordResetConfirmedEvent | AccountPasswordResetConfirmedEvent |
accountAggregate.AccountPasswordResetRequestedEvent | AccountPasswordResetRequestedEvent |
accountAggregate.AccountPasswordChangedEvent | AccountPasswordChangedEvent |
accountAggregate.AccountRegisterConfirmedEvent | AccountRegisterConfirmedEvent |
comby.AllDomainEvent | OnHandleEventForTenantAggregateTuples |
Custom Permissions
Name | Type | Comment |
---|---|---|
Command | CommandWithoutTargetAggregate | |
Command | CommandWithTargetAggregate |
Group
Commands
- GroupCommandCreate
- GroupCommandRemove
- GroupCommandRemoveAttribute
- GroupCommandSetAttribute
- GroupCommandUpdate
GroupCommandCreate
Domain Command Struct:
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:
func (cs *commandHandler) GroupCommandCreate(ctx context.Context, cmd comby.Command, domainCmd *GroupCommandCreate) ([]comby.Event, error)
GroupCommandRemove
Domain Command Struct:
type GroupCommandRemove struct {
GroupUuid string `json:"groupUuid"`
}
Domain Command Handling Method:
func (cs *commandHandler) GroupCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *GroupCommandRemove) ([]comby.Event, error)
GroupCommandRemoveAttribute
Domain Command Struct:
type GroupCommandRemoveAttribute struct {
GroupUuid string `json:"groupUuid"`
Key string `json:"key"`
}
Domain Command Handling Method:
func (cs *commandHandler) GroupCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *GroupCommandRemoveAttribute) ([]comby.Event, error)
GroupCommandSetAttribute
Domain Command Struct:
type GroupCommandSetAttribute struct {
GroupUuid string `json:"groupUuid"`
Key string `json:"key"`
Value any `json:"value"`
}
Domain Command Handling Method:
func (cs *commandHandler) GroupCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *GroupCommandSetAttribute) ([]comby.Event, error)
GroupCommandUpdate
Domain Command Struct:
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:
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:
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"`
}
Domain Query Handling Method:
func (qs *queryHandler) GroupQueryList(ctx context.Context, qry comby.Query, domainQry *GroupQueryList) (*GroupQueryListResponse, error)
GroupQueryModelByName
Domain Query Struct:
type GroupQueryModelByName struct {
Name string `json:"name"`
}
Domain Query Handling Method:
func (qs *queryHandler) GroupQueryModelByName(ctx context.Context, qry comby.Query, domainQry *GroupQueryModelByName) (*GroupQueryItemResponse, error)
GroupQueryModel
Domain Query Struct:
type GroupQueryModel struct {
GroupUuid string `json:"groupUuid"`
}
Domain Query Handling Method:
func (qs *queryHandler) GroupQueryModel(ctx context.Context, qry comby.Query, domainQry *GroupQueryModel) (*GroupQueryItemResponse, error)
GroupQueryListResponse
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
type GroupQueryItemResponse struct {
Item *readmodel.GroupModel `json:"item,omitempty"`
}
Events
GroupAddedEvent
Domain Event Struct:
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:
func (agg *Group) GroupAddedEvent(ctx context.Context, evt comby.Event, domainEvt *GroupAddedEvent) (error)
GroupRemovedEvent
Domain Event Struct:
type GroupRemovedEvent struct {
Reason string `json:"reason,omitempty"`
}
Domain Event Handling Method:
func (agg *Group) GroupRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *GroupRemovedEvent) (error)
GroupAttributeRemovedEvent
Domain Event Struct:
type GroupAttributeRemovedEvent struct {
Key string `json:"key"`
}
Domain Event Handling Method:
func (agg *Group) GroupAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *GroupAttributeRemovedEvent) (error)
GroupAttributeSetEvent
Domain Event Struct:
type GroupAttributeSetEvent struct {
Key string `json:"key"`
Value any `json:"value"`
}
Domain Event Handling Method:
func (agg *Group) GroupAttributeSetEvent(ctx context.Context, evt comby.Event, domainEvt *GroupAttributeSetEvent) (error)
GroupUpdatedEvent
Domain Event Struct:
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:
func (agg *Group) GroupUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *GroupUpdatedEvent) (error)
Aggregate
Aggregate Struct:
type Group struct {
*comby.BaseAggregate
// Value Objects
Permissions []string
Name string
Description string
}
Methods
Add
func (agg *Group) Add(name, description, attributes string, permissions []string) (error)
Remove
func (agg *Group) Remove() (error)
RemoveAttribute
func (agg *Group) RemoveAttribute(key string) (error)
SetAttribute
func (agg *Group) SetAttribute(key string, value any) (error)
Update
func (agg *Group) Update(name, description, attributes string, permissions []string) (error)
Event Handlers
GroupReadmodel
Domain Event | Method |
---|---|
tenantAggregate.TenantCreatedEvent | TenantCreatedEvent |
tenantAggregate.TenantRemovedEvent | TenantRemovedEvent |
tenantAggregate.TenantUpdatedEvent | TenantUpdatedEvent |
groupAggregate.GroupAddedEvent | GroupAddedEvent |
groupAggregate.GroupUpdatedEvent | GroupUpdatedEvent |
groupAggregate.GroupRemovedEvent | GroupRemovedEvent |
groupAggregate.GroupAttributeSetEvent | GroupAttributeSetEvent |
groupAggregate.GroupAttributeRemovedEvent | GroupAttributeRemovedEvent |
Custom Permissions
Name | Type | Comment |
---|---|---|
GroupCommandCreate | Command | Create new group |
GroupCommandUpdate | Command | Update existing group |
GroupCommandRemove | Command | Remove existing group |
GroupCommandSetAttribute | Command | Set single attribute of existing group |
GroupCommandRemoveAttribute | Command | Remove single attribute from existing group |
GroupQueryList | Query | List groups |
GroupQueryModel | Query | Get group by id |
GroupQueryModelByName | Query | Get group by name |
Identity
Commands
- IdentityCommandAddGroup
- IdentityCommandAddToken
- IdentityCommandCreate
- IdentityCommandRemove
- IdentityCommandRemoveAttribute
- IdentityCommandRemoveGroup
- IdentityCommandRemoveToken
- IdentityCommandSetAttribute
- IdentityCommandUpdate
- IdentityCommandUpdateProfile
IdentityCommandAddGroup
Domain Command Struct:
type IdentityCommandAddGroup struct {
IdentityUuid string `json:"identityUuid"`
GroupUuid string `json:"groupUuid"`
}
Domain Command Handling Method:
func (cs *commandHandler) IdentityCommandAddGroup(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandAddGroup) ([]comby.Event, error)
IdentityCommandAddToken
Domain Command Struct:
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:
func (cs *commandHandler) IdentityCommandAddToken(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandAddToken) ([]comby.Event, error)
IdentityCommandCreate
Domain Command Struct:
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:
func (cs *commandHandler) IdentityCommandCreate(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandCreate) ([]comby.Event, error)
IdentityCommandRemove
Domain Command Struct:
type IdentityCommandRemove struct {
IdentityUuid string `json:"identityUuid"`
}
Domain Command Handling Method:
func (cs *commandHandler) IdentityCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandRemove) ([]comby.Event, error)
IdentityCommandRemoveAttribute
Domain Command Struct:
type IdentityCommandRemoveAttribute struct {
IdentityUuid string `json:"identityUuid"`
Key string `json:"key"`
}
Domain Command Handling Method:
func (cs *commandHandler) IdentityCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandRemoveAttribute) ([]comby.Event, error)
IdentityCommandRemoveGroup
Domain Command Struct:
type IdentityCommandRemoveGroup struct {
IdentityUuid string `json:"identityUuid"`
GroupUuid string `json:"groupUuid"`
}
Domain Command Handling Method:
func (cs *commandHandler) IdentityCommandRemoveGroup(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandRemoveGroup) ([]comby.Event, error)
IdentityCommandRemoveToken
Domain Command Struct:
type IdentityCommandRemoveToken struct {
IdentityUuid string `json:"identityUuid"`
TokenUuid string `json:"tokenUuid"`
}
Domain Command Handling Method:
func (cs *commandHandler) IdentityCommandRemoveToken(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandRemoveToken) ([]comby.Event, error)
IdentityCommandSetAttribute
Domain Command Struct:
type IdentityCommandSetAttribute struct {
IdentityUuid string `json:"identityUuid"`
Key string `json:"key"`
Value any `json:"value"`
}
Domain Command Handling Method:
func (cs *commandHandler) IdentityCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandSetAttribute) ([]comby.Event, error)
IdentityCommandUpdate
Domain Command Struct:
type IdentityCommandUpdate struct {
IdentityUuid string `json:"identityUuid"`
Attributes string `json:"attributes,omitempty"`
PatchedFields []string `json:"patchedFields"`
}
Domain Command Handling Method:
func (cs *commandHandler) IdentityCommandUpdate(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandUpdate) ([]comby.Event, error)
IdentityCommandUpdateProfile
Domain Command Struct:
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:
func (cs *commandHandler) IdentityCommandUpdateProfile(ctx context.Context, cmd comby.Command, domainCmd *IdentityCommandUpdateProfile) ([]comby.Event, error)
Queries
Domain Query Structs:
- IdentityQueryListByAccountUuid
- IdentityQueryListByAccountTenantUuid
- IdentityQueryList
- IdentityQueryModel
- IdentityQueryModelIndependentOfOrganization
Domain Query Responses:
IdentityQueryListByAccountUuid
Domain Query Struct:
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:
func (qs *queryHandler) IdentityQueryListByAccountUuid(ctx context.Context, qry comby.Query, domainQry *IdentityQueryListByAccountUuid) (*IdentityQueryListResponse, error)
IdentityQueryListByAccountTenantUuid
Domain Query Struct:
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:
func (qs *queryHandler) IdentityQueryListByAccountTenantUuid(ctx context.Context, qry comby.Query, domainQry *IdentityQueryListByAccountTenantUuid) (*IdentityQueryListResponse, error)
IdentityQueryList
Domain Query Struct:
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"`
}
Domain Query Handling Method:
func (qs *queryHandler) IdentityQueryList(ctx context.Context, qry comby.Query, domainQry *IdentityQueryList) (*IdentityQueryListResponse, error)
IdentityQueryModel
Domain Query Struct:
type IdentityQueryModel struct {
IdentityUuid string `json:"identityUuid"`
}
Domain Query Handling Method:
func (qs *queryHandler) IdentityQueryModel(ctx context.Context, qry comby.Query, domainQry *IdentityQueryModel) (*IdentityQueryItemResponse, error)
IdentityQueryModelIndependentOfOrganization
Domain Query Struct:
type IdentityQueryModelIndependentOfOrganization struct {
SessionUuid string `json:"sessionUuid"`
IdentityUuid string `json:"identityUuid,omitempty"`
}
Domain Query Handling Method:
func (qs *queryHandler) IdentityQueryModelIndependentOfOrganization(ctx context.Context, qry comby.Query, domainQry *IdentityQueryModelIndependentOfOrganization) (*IdentityQueryItemResponse, error)
IdentityQueryListResponse
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
type IdentityQueryItemResponse struct {
Item *readmodel.IdentityModel `json:"item,omitempty"`
}
Events
- IdentityAddedGroupEvent
- IdentityAddedTokenEvent
- IdentityCreatedEvent
- IdentityRemovedEvent
- IdentityAttributeRemovedEvent
- IdentityRemovedGroupEvent
- IdentityRemovedTokenEvent
- IdentityAttributeSetEvent
- IdentityUpdatedEvent
- IdentityProfileUpdatedEvent
IdentityAddedGroupEvent
Domain Event Struct:
type IdentityAddedGroupEvent struct {
GroupUuid string `json:"groupUuid"`
}
Domain Event Handling Method:
func (agg *Identity) IdentityAddedGroupEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityAddedGroupEvent) (error)
IdentityAddedTokenEvent
Domain Event Struct:
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:
func (agg *Identity) IdentityAddedTokenEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityAddedTokenEvent) (error)
IdentityCreatedEvent
Domain Event Struct:
type IdentityCreatedEvent struct {
AccountUuid string `json:"accountUuid,omitempty"`
Attributes string `json:"attributes,omitempty"`
}
Domain Event Handling Method:
func (agg *Identity) IdentityCreatedEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityCreatedEvent) (error)
IdentityRemovedEvent
Domain Event Struct:
type IdentityRemovedEvent struct {
Reason string `json:"reason,omitempty"`
}
Domain Event Handling Method:
func (agg *Identity) IdentityRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityRemovedEvent) (error)
IdentityAttributeRemovedEvent
Domain Event Struct:
type IdentityAttributeRemovedEvent struct {
Key string `json:"key"`
}
Domain Event Handling Method:
func (agg *Identity) IdentityAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityAttributeRemovedEvent) (error)
IdentityRemovedGroupEvent
Domain Event Struct:
type IdentityRemovedGroupEvent struct {
GroupUuid string `json:"groupUuid"`
}
Domain Event Handling Method:
func (agg *Identity) IdentityRemovedGroupEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityRemovedGroupEvent) (error)
IdentityRemovedTokenEvent
Domain Event Struct:
type IdentityRemovedTokenEvent struct {
TokenUuid string `json:"tokenUuid"`
}
Domain Event Handling Method:
func (agg *Identity) IdentityRemovedTokenEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityRemovedTokenEvent) (error)
IdentityAttributeSetEvent
Domain Event Struct:
type IdentityAttributeSetEvent struct {
Key string `json:"key"`
Value any `json:"value"`
}
Domain Event Handling Method:
func (agg *Identity) IdentityAttributesSetEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityAttributeSetEvent) (error)
IdentityUpdatedEvent
Domain Event Struct:
type IdentityUpdatedEvent struct {
Attributes string `json:"attributes,omitempty"`
}
Domain Event Handling Method:
func (agg *Identity) IdentityUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityUpdatedEvent) (error)
IdentityProfileUpdatedEvent
Domain Event Struct:
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:
func (agg *Identity) IdentityProfileUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *IdentityProfileUpdatedEvent) (error)
Aggregate
Aggregate Struct:
type Identity struct {
*comby.BaseAggregate
// References
AccountUuid string
GroupUuids []string
// Entities
Profile *Profile
Tokens []*Token
}
Methods
AddGroup
func (agg *Identity) AddGroup(groupUuid string) (error)
AddToken
func (agg *Identity) AddToken(tokenUuid, tokenValue, name, description string, expiredAt int64) (error)
Add
func (agg *Identity) Add(accountUuid, attributes string) (error)
Remove
func (agg *Identity) Remove() (error)
RemoveAttribute
func (agg *Identity) RemoveAttribute(key string) (error)
RemoveGroup
func (agg *Identity) RemoveGroup(groupUuid string) (error)
RemoveToken
func (agg *Identity) RemoveToken(tokenUuid string) (error)
SetAttribute
func (agg *Identity) SetAttribute(key string, value any) (error)
Update
func (agg *Identity) Update(attributes string) (error)
UpdateProfile
func (agg *Identity) UpdateProfile(name, email, title, avatar string) (error)
Event Handlers
IdentityReadmodel
Domain Event | Method |
---|---|
tenantAggregate.TenantCreatedEvent | TenantCreatedEvent |
tenantAggregate.TenantAttributeRemovedEvent | TenantAttributeRemovedEvent |
tenantAggregate.TenantAttributeSetEvent | TenantAttributeSetEvent |
tenantAggregate.TenantUpdatedEvent | TenantUpdatedEvent |
tenantAggregate.TenantRemovedEvent | TenantRemovedEvent |
identityAggregate.IdentityAttributeRemovedEvent | IdentityAttributeRemovedEvent |
identityAggregate.IdentityRemovedTokenEvent | IdentityRemovedTokenEvent |
identityAggregate.IdentityUpdatedEvent | IdentityUpdatedEvent |
identityAggregate.IdentityRemovedEvent | IdentityRemovedEvent |
identityAggregate.IdentityAddedGroupEvent | IdentityAddedGroupEvent |
identityAggregate.IdentityRemovedGroupEvent | IdentityRemovedGroupEvent |
identityAggregate.IdentityAddedTokenEvent | IdentityAddedTokenEvent |
identityAggregate.IdentityCreatedEvent | IdentityCreatedEvent |
identityAggregate.IdentityProfileUpdatedEvent | IdentityProfileUpdatedEvent |
identityAggregate.IdentityAttributeSetEvent | IdentityAttributeSetEvent |
groupAggregate.GroupUpdatedEvent | GroupUpdatedEvent |
groupAggregate.GroupRemovedEvent | GroupRemovedEvent |
groupAggregate.GroupAddedEvent | GroupAddedEvent |
assetAggregate.AssetAddedEvent | AssetAddedEvent |
assetAggregate.AssetRemovedEvent | AssetRemovedEvent |
assetAggregate.AssetUpdatedEvent | AssetUpdatedEvent |
Custom Permissions
Name | Type | Comment |
---|---|---|
IdentityCommandAddToken | Command | Add token for any other identity |
IdentityCommandRemoveToken | Command | Remove token of any other identity |
IdentityCommandUpdateProfile | Command | Update profile of any other identity |
IdentityCommandSetAttribute | Command | Set attributes of any other identity |
Invitation
Commands
- InvitationCommandAccept
- InvitationCommandCreate
- InvitationCommandDecline
- InvitationCommandRemove
- InvitationCommandRemoveAttribute
- InvitationCommandSend
- InvitationCommandSetAttribute
- InvitationCommandUpdate
InvitationCommandAccept
Domain Command Struct:
type InvitationCommandAccept struct {
InvitationUuid string `json:"invitationUuid"`
AccountUuid string `json:"accountUuid"`
Token string `json:"token"`
}
Domain Command Handling Method:
func (cs *commandHandler) InvitationCommandAccept(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandAccept) ([]comby.Event, error)
InvitationCommandCreate
Domain Command Struct:
type InvitationCommandCreate struct {
InvitationUuid string `json:"invitationUuid"`
IdentityUuid string `json:"identityUuid"`
GroupUuids []string `json:"groupUuids"`
Email string `json:"email"`
Attributes string `json:"attributes,omitempty"`
}
Domain Command Handling Method:
func (cs *commandHandler) InvitationCommandCreate(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandCreate) ([]comby.Event, error)
InvitationCommandDecline
Domain Command Struct:
type InvitationCommandDecline struct {
InvitationUuid string `json:"invitationUuid"`
AccountUuid string `json:"accountUuid"`
Token string `json:"token"`
}
Domain Command Handling Method:
func (cs *commandHandler) InvitationCommandDecline(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandDecline) ([]comby.Event, error)
InvitationCommandRemove
Domain Command Struct:
type InvitationCommandRemove struct {
InvitationUuid string `json:"invitationUuid"`
}
Domain Command Handling Method:
func (cs *commandHandler) InvitationCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandRemove) ([]comby.Event, error)
InvitationCommandRemoveAttribute
Domain Command Struct:
type InvitationCommandRemoveAttribute struct {
InvitationUuid string `json:"invitationUuid"`
Key string `json:"key"`
}
Domain Command Handling Method:
func (cs *commandHandler) InvitationCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandRemoveAttribute) ([]comby.Event, error)
InvitationCommandSend
Domain Command Struct:
type InvitationCommandSend struct {
InvitationUuid string `json:"invitationUuid"`
}
Domain Command Handling Method:
func (cs *commandHandler) InvitationCommandSend(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandSend) ([]comby.Event, error)
InvitationCommandSetAttribute
Domain Command Struct:
type InvitationCommandSetAttribute struct {
InvitationUuid string `json:"invitationUuid"`
Key string `json:"key"`
Value any `json:"value"`
}
Domain Command Handling Method:
func (cs *commandHandler) InvitationCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *InvitationCommandSetAttribute) ([]comby.Event, error)
InvitationCommandUpdate
Domain Command Struct:
type InvitationCommandUpdate struct {
InvitationUuid string `json:"invitationUuid"`
Attributes string `json:"attributes,omitempty"`
PatchedFields []string `json:"patchedFields"`
}
Domain Command Handling Method:
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:
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"`
}
Domain Query Handling Method:
func (qs *queryHandler) InvitationQueryList(ctx context.Context, qry comby.Query, domainQry *InvitationQueryList) (*InvitationQueryListResponse, error)
InvitationQueryModel
Domain Query Struct:
type InvitationQueryModel struct {
InvitationUuid string `json:"invitationUuid"`
}
Domain Query Handling Method:
func (qs *queryHandler) InvitationQueryModel(ctx context.Context, qry comby.Query, domainQry *InvitationQueryModel) (*InvitationQueryItemResponse, error)
InvitationQueryModelByInvitationToken
Domain Query Struct:
type InvitationQueryModelByInvitationToken struct {
InvitationToken string `json:"invitationToken"`
}
Domain Query Handling Method:
func (qs *queryHandler) InvitationQueryModelByInvitationToken(ctx context.Context, qry comby.Query, domainQry *InvitationQueryModelByInvitationToken) (*InvitationQueryItemResponse, error)
InvitationQueryListResponse
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
type InvitationQueryItemResponse struct {
Item *readmodel.InvitationModel `json:"item,omitempty"`
}
Events
- InvitationAcceptedEvent
- InvitationCreatedEvent
- InvitationDeclinedEvent
- InvitationRemovedEvent
- InvitationAttributeRemovedEvent
- InvitationSentEvent
- InvitationAttributeSetEvent
- InvitationUpdatedEvent
InvitationAcceptedEvent
Domain Event Struct:
type InvitationAcceptedEvent struct {
AccountUuid string `json:"accountUuid"`
}
Domain Event Handling Method:
func (agg *Invitation) InvitationAcceptedEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationAcceptedEvent) (error)
InvitationCreatedEvent
Domain Event Struct:
type InvitationCreatedEvent struct {
IdentityUuid string `json:"identityUuid"`
GroupUuids []string `json:"groupUuids"`
Token string `json:"token"`
Email string `json:"email"`
Attributes string `json:"attributes,omitempty"`
}
Domain Event Handling Method:
func (agg *Invitation) InvitationCreatedEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationCreatedEvent) (error)
InvitationDeclinedEvent
Domain Event Struct:
type InvitationDeclinedEvent struct {
AccountUuid string `json:"accountUuid"`
}
Domain Event Handling Method:
func (agg *Invitation) InvitationDeclinedEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationDeclinedEvent) (error)
InvitationRemovedEvent
Domain Event Struct:
type InvitationRemovedEvent struct {
Reason string `json:"reason,omitempty"`
}
Domain Event Handling Method:
func (agg *Invitation) InvitationRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationRemovedEvent) (error)
InvitationAttributeRemovedEvent
Domain Event Struct:
type InvitationAttributeRemovedEvent struct {
Key string `json:"key"`
}
Domain Event Handling Method:
func (agg *Invitation) InvitationAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationAttributeRemovedEvent) (error)
InvitationSentEvent
Domain Event Struct:
type InvitationSentEvent struct {
State string `json:"state"`
}
Domain Event Handling Method:
func (agg *Invitation) InvitationSentEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationSentEvent) (error)
InvitationAttributeSetEvent
Domain Event Struct:
type InvitationAttributeSetEvent struct {
Key string `json:"key"`
Value any `json:"value"`
}
Domain Event Handling Method:
func (agg *Invitation) InvitationAttributeSetEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationAttributeSetEvent) (error)
InvitationUpdatedEvent
Domain Event Struct:
type InvitationUpdatedEvent struct {
Attributes string `json:"attributes,omitempty"`
}
Domain Event Handling Method:
func (agg *Invitation) InvitationUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *InvitationUpdatedEvent) (error)
Aggregate
Aggregate Struct:
type Invitation struct {
*comby.BaseAggregate
// GroupUuids groups to which the invited account will be added
GroupUuids []string
// IdentityUuid who created the invitation
IdentityUuid string
// AccountUuid who accepted the invitation
AccountUuid string
// Value Objects
Token string
Email string
State string
}
Methods
Accept
func (agg *Invitation) Accept(accountUuid string) (error)
Create
func (agg *Invitation) Create(identityUuid string, groupUuids []string, token, email, attributes string) (error)
Decline
func (agg *Invitation) Decline(accountUuid string) (error)
Remove
func (agg *Invitation) Remove() (error)
RemoveAttribute
func (agg *Invitation) RemoveAttribute(key string) (error)
Send
func (agg *Invitation) Send() (error)
SetAttribute
func (agg *Invitation) SetAttribute(key string, value any) (error)
Update
func (agg *Invitation) Update(attributes string) (error)
Event Handlers
Reactor
Domain Event | Method |
---|---|
aggregateInvitation.InvitationCreatedEvent | InvitationCreatedEvent |
aggregateInvitation.InvitationAcceptedEvent | InvitationAcceptedEvent |
InvitationReadmodel
Domain Event | Method |
---|---|
tenantAggregate.TenantCreatedEvent | TenantCreatedEvent |
tenantAggregate.TenantUpdatedEvent | TenantUpdatedEvent |
tenantAggregate.TenantRemovedEvent | TenantRemovedEvent |
invitationAggregate.InvitationSentEvent | InvitationSentEvent |
invitationAggregate.InvitationAcceptedEvent | InvitationAcceptedEvent |
invitationAggregate.InvitationAttributeRemovedEvent | InvitationAttributeRemovedEvent |
invitationAggregate.InvitationAttributeSetEvent | InvitationAttributeSetEvent |
invitationAggregate.InvitationCreatedEvent | InvitationCreatedEvent |
invitationAggregate.InvitationUpdatedEvent | InvitationUpdatedEvent |
invitationAggregate.InvitationRemovedEvent | InvitationRemovedEvent |
invitationAggregate.InvitationDeclinedEvent | InvitationDeclinedEvent |
identityAggregate.IdentityCreatedEvent | IdentityCreatedEvent |
identityAggregate.IdentityProfileUpdatedEvent | IdentityProfileUpdatedEvent |
identityAggregate.IdentityRemovedEvent | IdentityRemovedEvent |
groupAggregate.GroupUpdatedEvent | GroupUpdatedEvent |
groupAggregate.GroupRemovedEvent | GroupRemovedEvent |
groupAggregate.GroupAddedEvent | GroupAddedEvent |
accountAggregate.AccountCredentialsUpdatedEvent | AccountCredentialsUpdatedEvent |
Tenant
Commands
- TenantCommandCreate
- TenantCommandRemove
- TenantCommandRemoveAttribute
- TenantCommandRemoveSecret
- TenantCommandSetAttribute
- TenantCommandSetSecret
- TenantCommandUpdate
TenantCommandCreate
Domain Command Struct:
type TenantCommandCreate struct {
TenantUuid string `json:"tenantUuid"`
Name string `json:"name"`
Attributes string `json:"attributes,omitempty"`
}
Domain Command Handling Method:
func (cs *commandHandler) TenantCommandCreate(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandCreate) ([]comby.Event, error)
TenantCommandRemove
Domain Command Struct:
type TenantCommandRemove struct {
TenantUuid string `json:"tenantUuid"`
}
Domain Command Handling Method:
func (cs *commandHandler) TenantCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandRemove) ([]comby.Event, error)
TenantCommandRemoveAttribute
Domain Command Struct:
type TenantCommandRemoveAttribute struct {
TenantUuid string `json:"tenantUuid"`
Key string `json:"key"`
}
Domain Command Handling Method:
func (ch *commandHandler) TenantCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandRemoveAttribute) ([]comby.Event, error)
TenantCommandRemoveSecret
Domain Command Struct:
type TenantCommandRemoveSecret struct {
TenantUuid string `json:"tenantUuid"`
SecretKey string `json:"secretKey"`
}
Domain Command Handling Method:
func (ch *commandHandler) TenantCommandRemoveSecret(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandRemoveSecret) ([]comby.Event, error)
TenantCommandSetAttribute
Domain Command Struct:
type TenantCommandSetAttribute struct {
TenantUuid string `json:"tenantUuid"`
Key string `json:"key"`
Value any `json:"value"`
}
Domain Command Handling Method:
func (cs *commandHandler) TenantCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandSetAttribute) ([]comby.Event, error)
TenantCommandSetSecret
Domain Command Struct:
type TenantCommandSetSecret struct {
TenantUuid string `json:"tenantUuid"`
SecretKey string `json:"secretKey"`
SecretValue string `json:"secretValue,omitempty"`
}
Domain Command Handling Method:
func (cs *commandHandler) TenantCommandSetSecret(ctx context.Context, cmd comby.Command, domainCmd *TenantCommandSetSecret) ([]comby.Event, error)
TenantCommandUpdate
Domain Command Struct:
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:
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:
- 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.
- 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:
type TenantQueryList struct {
Page int64 `json:"page,omitempty"`
PageSize int64 `json:"pageSize,omitempty"`
OrderBy string `json:"orderBy,omitempty"`
Attributes string `json:"attributes,omitempty"`
}
Domain Query Handling Method:
func (qs *queryHandler) TenantQueryList(ctx context.Context, qry comby.Query, domainQry *TenantQueryList) (*TenantQueryListResponse, error)
TenantQueryModelByName
Domain Query Struct:
type TenantQueryModelByName struct {
Name string `json:"name"`
}
Domain Query Handling Method:
func (qs *queryHandler) TenantQueryModelByName(ctx context.Context, qry comby.Query, domainQry *TenantQueryModelByName) (*TenantQueryItemResponse, error)
TenantQueryModel
Domain Query Struct:
type TenantQueryModel struct {
TenantUuid string `json:"tenantUuid"`
}
Domain Query Handling Method:
func (qs *queryHandler) TenantQueryModel(ctx context.Context, qry comby.Query, domainQry *TenantQueryModel) (*TenantQueryItemResponse, error)
TenantQueryListResponse
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
type TenantQueryItemResponse struct {
Item *readmodel.TenantModel `json:"item,omitempty"`
}
Events
- TenantCreatedEvent
- TenantRemovedEvent
- TenantAttributeRemovedEvent
- TenantSecretRemovedEvent
- TenantAttributeSetEvent
- TenantSecretSetEvent
- TenantUpdatedEvent
TenantCreatedEvent
Domain Event Struct:
type TenantCreatedEvent struct {
Name string `json:"name"`
Attributes string `json:"attributes,omitempty"`
}
Domain Event Handling Method:
func (agg *Tenant) TenantCreatedEvent(ctx context.Context, evt comby.Event, domainEvt *TenantCreatedEvent) (error)
TenantRemovedEvent
Domain Event Struct:
type TenantRemovedEvent struct {
Reason string `json:"reason,omitempty"`
}
Domain Event Handling Method:
func (agg *Tenant) TenantRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *TenantRemovedEvent) (error)
TenantAttributeRemovedEvent
Domain Event Struct:
type TenantAttributeRemovedEvent struct {
Key string `json:"key"`
}
Domain Event Handling Method:
func (agg *Tenant) TenantAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *TenantAttributeRemovedEvent) (error)
TenantSecretRemovedEvent
Domain Event Struct:
type TenantSecretRemovedEvent struct {
SecretKey string `json:"secretKey"`
}
Domain Event Handling Method:
func (agg *Tenant) TenantSecretRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *TenantSecretRemovedEvent) (error)
TenantAttributeSetEvent
Domain Event Struct:
type TenantAttributeSetEvent struct {
Key string `json:"key"`
Value any `json:"value"`
}
Domain Event Handling Method:
func (agg *Tenant) TenantAttributeSetEvent(ctx context.Context, evt comby.Event, domainEvt *TenantAttributeSetEvent) (error)
TenantSecretSetEvent
Domain Event Struct:
type TenantSecretSetEvent struct {
SecretKey string `json:"SecretKey"`
SecretValue string `json:"SecretValue,omitempty"`
}
Domain Event Handling Method:
func (agg *Tenant) TenantSecretSetEvent(ctx context.Context, evt comby.Event, domainEvt *TenantSecretSetEvent) (error)
TenantUpdatedEvent
Domain Event Struct:
type TenantUpdatedEvent struct {
Name string `json:"name,omitempty"`
Attributes string `json:"attributes,omitempty"`
}
Domain Event Handling Method:
func (agg *Tenant) TenantUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *TenantUpdatedEvent) (error)
Aggregate
Aggregate Struct:
type Tenant struct {
*comby.BaseAggregate
// Value Objects
Name string
Secrets *comby.Attributes
}
Methods
Create
func (agg *Tenant) Create(name, attributes string) (error)
Remove
func (agg *Tenant) Remove() (error)
RemoveAttribute
func (agg *Tenant) RemoveAttribute(key string) (error)
RemoveSecret
func (agg *Tenant) RemoveSecret(key string) (error)
SetAttribute
func (agg *Tenant) SetAttribute(key string, value any) (error)
SetSecret
func (agg *Tenant) SetSecret(key, value string) (error)
Update
func (agg *Tenant) Update(name, attributes string) (error)
Event Handlers
TenantReadmodel
Domain Event | Method |
---|---|
webhookAggregate.WebhookRemovedEvent | WebhookRemovedEvent |
webhookAggregate.WebhookAddedEvent | WebhookAddedEvent |
tenantAggregate.TenantCreatedEvent | TenantCreatedEvent |
tenantAggregate.TenantSecretRemovedEvent | TenantSecretRemovedEvent |
tenantAggregate.TenantSecretSetEvent | TenantSecretSetEvent |
tenantAggregate.TenantAttributeRemovedEvent | TenantAttributeRemovedEvent |
tenantAggregate.TenantAttributeSetEvent | TenantAttributeSetEvent |
tenantAggregate.TenantUpdatedEvent | TenantUpdatedEvent |
tenantAggregate.TenantRemovedEvent | TenantRemovedEvent |
invitationAggregate.InvitationCreatedEvent | InvitationCreatedEvent |
invitationAggregate.InvitationRemovedEvent | InvitationRemovedEvent |
identityAggregate.IdentityProfileUpdatedEvent | IdentityProfileUpdatedEvent |
identityAggregate.IdentityRemovedEvent | IdentityRemovedEvent |
identityAggregate.IdentityCreatedEvent | IdentityCreatedEvent |
groupAggregate.GroupUpdatedEvent | GroupUpdatedEvent |
groupAggregate.GroupRemovedEvent | GroupRemovedEvent |
groupAggregate.GroupAddedEvent | GroupAddedEvent |
assetAggregate.AssetAddedEvent | AssetAddedEvent |
assetAggregate.AssetRemovedEvent | AssetRemovedEvent |
Webhook
Commands
- WebhookCommandAdd
- WebhookCommandRemove
- WebhookCommandRemoveAttribute
- WebhookCommandSetAttribute
- WebhookCommandUpdate
WebhookCommandAdd
Domain Command Struct:
type WebhookCommandAdd struct {
WebhookUuid string `json:"webhookUuid"`
DomainEvtIdentifier string `json:"domainEvtIdentifier"`
WebhookUrl string `json:"webhookUrl"`
Attributes string `json:"attributes,omitempty"`
}
Domain Command Handling Method:
func (cs *commandHandler) WebhookCommandAdd(ctx context.Context, cmd comby.Command, domainCmd *WebhookCommandAdd) ([]comby.Event, error)
WebhookCommandRemove
Domain Command Struct:
type WebhookCommandRemove struct {
WebhookUuid string `json:"webhookUuid"`
}
Domain Command Handling Method:
func (cs *commandHandler) WebhookCommandRemove(ctx context.Context, cmd comby.Command, domainCmd *WebhookCommandRemove) ([]comby.Event, error)
WebhookCommandRemoveAttribute
Domain Command Struct:
type WebhookCommandRemoveAttribute struct {
WebhookUuid string `json:"webhookUuid"`
Key string `json:"key"`
}
Domain Command Handling Method:
func (cs *commandHandler) WebhookCommandRemoveAttribute(ctx context.Context, cmd comby.Command, domainCmd *WebhookCommandRemoveAttribute) ([]comby.Event, error)
WebhookCommandSetAttribute
Domain Command Struct:
type WebhookCommandSetAttribute struct {
WebhookUuid string `json:"webhookUuid"`
Key string `json:"key"`
Value any `json:"value"`
}
Domain Command Handling Method:
func (cs *commandHandler) WebhookCommandSetAttribute(ctx context.Context, cmd comby.Command, domainCmd *WebhookCommandSetAttribute) ([]comby.Event, error)
WebhookCommandUpdate
Domain Command Struct:
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:
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:
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"`
}
Domain Query Handling Method:
func (qs *queryService) WebhookQueryList(ctx context.Context, qry comby.Query, domainQry *WebhookQueryList) (*WebhookQueryListResponse, error)
WebhookQueryModel
Domain Query Struct:
type WebhookQueryModel struct {
WebhookUuid string `json:"webhookUuid"`
}
Domain Query Handling Method:
func (qs *queryService) WebhookQueryModel(ctx context.Context, qry comby.Query, domainQry *WebhookQueryModel) (*WebhookQueryItemResponse, error)
WebhookQueryListResponse
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
type WebhookQueryItemResponse struct {
Item *readmodel.WebhookModel `json:"item,omitempty"`
}
Events
- WebhookAddedEvent
- WebhookRemovedEvent
- WebhookAttributeRemovedEvent
- WebhookAttributeSetEvent
- WebhookUpdatedEvent
WebhookAddedEvent
Domain Event Struct:
type WebhookAddedEvent struct {
DomainEvtIdentifier string `json:"domainEvtIdentifier"`
WebhookUrl string `json:"webhookUrl"`
Attributes string `json:"attributes,omitempty"`
}
Domain Event Handling Method:
func (agg *Webhook) WebhookAddedEvent(ctx context.Context, evt comby.Event, domainEvt *WebhookAddedEvent) (error)
WebhookRemovedEvent
Domain Event Struct:
type WebhookRemovedEvent struct {
Reason string `json:"reason,omitempty"`
}
Domain Event Handling Method:
func (agg *Webhook) WebhookRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *WebhookRemovedEvent) (error)
WebhookAttributeRemovedEvent
Domain Event Struct:
type WebhookAttributeRemovedEvent struct {
Key string `json:"key"`
}
Domain Event Handling Method:
func (agg *Webhook) WebhookAttributeRemovedEvent(ctx context.Context, evt comby.Event, domainEvt *WebhookAttributeRemovedEvent) (error)
WebhookAttributeSetEvent
Domain Event Struct:
type WebhookAttributeSetEvent struct {
Key string `json:"key"`
Value any `json:"value"`
}
Domain Event Handling Method:
func (agg *Webhook) WebhookAttributeSetEvent(ctx context.Context, evt comby.Event, domainEvt *WebhookAttributeSetEvent) (error)
WebhookUpdatedEvent
Domain Event Struct:
type WebhookUpdatedEvent struct {
Active bool `json:"active"`
DomainEvtIdentifier string `json:"domainEvtIdentifier"`
WebhookUrl string `json:"webhookUrl"`
Attributes string `json:"attributes,omitempty"`
}
Domain Event Handling Method:
func (agg *Webhook) WebhookUpdatedEvent(ctx context.Context, evt comby.Event, domainEvt *WebhookUpdatedEvent) (error)
Aggregate
Aggregate Struct:
type Webhook struct {
*comby.BaseAggregate
// Value Objects
Active bool
DomainEvtIdentifier string
WebhookUrl string
}
Methods
Add
func (agg *Webhook) Add(domainEvtIdentifier, webhookUrl, attributes string) (error)
Remove
func (agg *Webhook) Remove() (error)
RemoveAttribute
func (agg *Webhook) RemoveAttribute(key string) (error)
SetAttribute
func (agg *Webhook) SetAttribute(key string, value any) (error)
Update
func (agg *Webhook) Update(active bool, domainEvtIdentifier, webhookUrl, attributes string) (error)
Event Handlers
WebhookReadmodel
Domain Event | Method |
---|---|
webhookAggregate.WebhookAddedEvent | WebhookAddedEvent |
webhookAggregate.WebhookUpdatedEvent | WebhookUpdatedEvent |
webhookAggregate.WebhookRemovedEvent | WebhookRemovedEvent |
webhookAggregate.WebhookAttributeSetEvent | WebhookAttributeSetEvent |
webhookAggregate.WebhookAttributeRemovedEvent | WebhookAttributeRemovedEvent |
tenantAggregate.TenantCreatedEvent | TenantCreatedEvent |
tenantAggregate.TenantRemovedEvent | TenantRemovedEvent |
tenantAggregate.TenantUpdatedEvent | TenantUpdatedEvent |