2021-02-22 14:08:47 +01:00
|
|
|
package view
|
2020-05-13 14:22:29 +02:00
|
|
|
|
|
|
|
import (
|
2022-04-27 01:01:45 +02: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 14:22:29 +02:00
|
|
|
)
|
|
|
|
|
2022-05-16 15:10:10 +02:00
|
|
|
func OrgByIDQuery(id, instanceID string, latestSequence uint64) (*es_models.SearchQuery, error) {
|
2020-05-13 14:22:29 +02:00
|
|
|
if id == "" {
|
|
|
|
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-dke74", "id should be filled")
|
|
|
|
}
|
2021-02-22 14:08:47 +01:00
|
|
|
return es_models.NewSearchQuery().
|
2022-04-19 08:26:12 +02:00
|
|
|
AddQuery().
|
2022-03-31 11:36:26 +02:00
|
|
|
AggregateTypeFilter(org.AggregateType).
|
2022-04-19 08:26:12 +02:00
|
|
|
LatestSequenceFilter(latestSequence).
|
2022-05-16 15:10:10 +02:00
|
|
|
InstanceIDFilter(instanceID).
|
|
|
|
AggregateIDFilter(id).
|
2023-04-28 16:28:13 +02: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 15:10:10 +02:00
|
|
|
SearchQuery(), nil
|
2021-02-22 14:08:47 +01:00
|
|
|
}
|