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"
|
|
|
|
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
|
|
|
"github.com/zitadel/zitadel/internal/repository/org"
|
2020-05-13 12:22:29 +00:00
|
|
|
)
|
|
|
|
|
2022-05-16 13:10:10 +00:00
|
|
|
func OrgByIDQuery(id, instanceID string, latestSequence uint64) (*es_models.SearchQuery, error) {
|
2020-05-13 12:22:29 +00:00
|
|
|
if id == "" {
|
|
|
|
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-dke74", "id should be filled")
|
|
|
|
}
|
2021-02-22 13:08:47 +00:00
|
|
|
return es_models.NewSearchQuery().
|
2022-04-19 06:26:12 +00:00
|
|
|
AddQuery().
|
2022-03-31 09:36:26 +00:00
|
|
|
AggregateTypeFilter(org.AggregateType).
|
2022-04-19 06:26:12 +00:00
|
|
|
LatestSequenceFilter(latestSequence).
|
2022-05-16 13:10:10 +00:00
|
|
|
InstanceIDFilter(instanceID).
|
|
|
|
AggregateIDFilter(id).
|
2023-04-28 14:28:13 +00:00
|
|
|
EventTypesFilter(
|
|
|
|
es_models.EventType(org.OrgAddedEventType),
|
|
|
|
es_models.EventType(org.OrgChangedEventType),
|
|
|
|
es_models.EventType(org.OrgDeactivatedEventType),
|
|
|
|
es_models.EventType(org.OrgReactivatedEventType),
|
|
|
|
es_models.EventType(org.OrgDomainAddedEventType),
|
|
|
|
es_models.EventType(org.OrgDomainVerificationAddedEventType),
|
|
|
|
es_models.EventType(org.OrgDomainVerifiedEventType),
|
|
|
|
es_models.EventType(org.OrgDomainPrimarySetEventType),
|
|
|
|
es_models.EventType(org.OrgDomainRemovedEventType),
|
|
|
|
es_models.EventType(org.DomainPolicyAddedEventType),
|
|
|
|
es_models.EventType(org.DomainPolicyChangedEventType),
|
|
|
|
es_models.EventType(org.DomainPolicyRemovedEventType),
|
|
|
|
).
|
2022-05-16 13:10:10 +00:00
|
|
|
SearchQuery(), nil
|
2021-02-22 13:08:47 +00:00
|
|
|
}
|