2021-02-22 13:08:47 +00:00
|
|
|
package view
|
|
|
|
|
|
|
|
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/project"
|
2021-02-22 13:08:47 +00:00
|
|
|
)
|
|
|
|
|
2022-04-19 06:26:12 +00:00
|
|
|
func ProjectByIDQuery(id, instanceID string, latestSequence uint64) (*es_models.SearchQuery, error) {
|
2021-02-22 13:08:47 +00:00
|
|
|
if id == "" {
|
|
|
|
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-dke74", "Errors.Project.ProjectIDMissing")
|
|
|
|
}
|
|
|
|
return es_models.NewSearchQuery().
|
2022-04-19 06:26:12 +00:00
|
|
|
AddQuery().
|
2022-05-16 13:10:10 +00:00
|
|
|
AggregateIDFilter(id).
|
2022-03-31 09:36:26 +00:00
|
|
|
AggregateTypeFilter(project.AggregateType).
|
2022-04-19 06:26:12 +00:00
|
|
|
LatestSequenceFilter(latestSequence).
|
2022-05-16 13:10:10 +00:00
|
|
|
InstanceIDFilter(instanceID).
|
2023-04-28 14:28:13 +00:00
|
|
|
EventTypesFilter(
|
|
|
|
es_models.EventType(project.ProjectAddedType),
|
|
|
|
es_models.EventType(project.ProjectChangedType),
|
|
|
|
es_models.EventType(project.ProjectDeactivatedType),
|
|
|
|
es_models.EventType(project.ProjectReactivatedType),
|
|
|
|
es_models.EventType(project.ProjectRemovedType),
|
|
|
|
es_models.EventType(project.OIDCConfigAddedType),
|
|
|
|
es_models.EventType(project.ApplicationRemovedType),
|
|
|
|
).
|
2022-05-16 13:10:10 +00:00
|
|
|
SearchQuery(), nil
|
2021-02-22 13:08:47 +00:00
|
|
|
}
|