2021-02-22 13:08:47 +00:00
|
|
|
package view
|
2020-05-13 12:22:29 +00:00
|
|
|
|
|
|
|
import (
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/errors"
|
2023-10-19 10:19:10 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/repository/org"
|
2020-05-13 12:22:29 +00:00
|
|
|
)
|
|
|
|
|
2023-10-19 10:19:10 +00:00
|
|
|
func OrgByIDQuery(id, instanceID string, latestSequence uint64) (*eventstore.SearchQueryBuilder, error) {
|
2020-05-13 12:22:29 +00:00
|
|
|
if id == "" {
|
|
|
|
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-dke74", "id should be filled")
|
|
|
|
}
|
2023-10-19 10:19:10 +00:00
|
|
|
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent).
|
|
|
|
InstanceID(instanceID).
|
|
|
|
AwaitOpenTransactions().
|
|
|
|
SequenceGreater(latestSequence).
|
2022-04-19 06:26:12 +00:00
|
|
|
AddQuery().
|
2023-10-19 10:19:10 +00:00
|
|
|
AggregateTypes(org.AggregateType).
|
|
|
|
AggregateIDs(id).
|
|
|
|
EventTypes(
|
|
|
|
org.OrgAddedEventType,
|
|
|
|
org.OrgChangedEventType,
|
|
|
|
org.OrgDeactivatedEventType,
|
|
|
|
org.OrgReactivatedEventType,
|
|
|
|
org.OrgDomainAddedEventType,
|
|
|
|
org.OrgDomainVerificationAddedEventType,
|
|
|
|
org.OrgDomainVerifiedEventType,
|
|
|
|
org.OrgDomainPrimarySetEventType,
|
|
|
|
org.OrgDomainRemovedEventType,
|
|
|
|
org.DomainPolicyAddedEventType,
|
|
|
|
org.DomainPolicyChangedEventType,
|
|
|
|
org.DomainPolicyRemovedEventType,
|
2023-04-28 14:28:13 +00:00
|
|
|
).
|
2023-10-19 10:19:10 +00:00
|
|
|
Builder(), nil
|
2021-02-22 13:08:47 +00:00
|
|
|
}
|