2021-02-22 14:08:47 +01:00
|
|
|
package view
|
|
|
|
|
|
|
|
import (
|
2022-04-27 01:01:45 +02:00
|
|
|
"github.com/zitadel/zitadel/internal/errors"
|
2023-10-19 12:19:10 +02:00
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
2022-04-27 01:01:45 +02:00
|
|
|
"github.com/zitadel/zitadel/internal/repository/project"
|
2021-02-22 14:08:47 +01:00
|
|
|
)
|
|
|
|
|
2023-10-19 12:19:10 +02:00
|
|
|
func ProjectByIDQuery(id, instanceID string, latestSequence uint64) (*eventstore.SearchQueryBuilder, error) {
|
2021-02-22 14:08:47 +01:00
|
|
|
if id == "" {
|
|
|
|
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-dke74", "Errors.Project.ProjectIDMissing")
|
|
|
|
}
|
2023-10-19 12:19:10 +02:00
|
|
|
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent).
|
|
|
|
InstanceID(instanceID).
|
|
|
|
AwaitOpenTransactions().
|
|
|
|
SequenceGreater(latestSequence).
|
2022-04-19 08:26:12 +02:00
|
|
|
AddQuery().
|
2023-10-19 12:19:10 +02:00
|
|
|
AggregateTypes(project.AggregateType).
|
|
|
|
AggregateIDs(id).
|
|
|
|
EventTypes(
|
|
|
|
project.ProjectAddedType,
|
|
|
|
project.ProjectChangedType,
|
|
|
|
project.ProjectDeactivatedType,
|
|
|
|
project.ProjectReactivatedType,
|
|
|
|
project.ProjectRemovedType,
|
|
|
|
project.OIDCConfigAddedType,
|
|
|
|
project.ApplicationRemovedType,
|
2023-04-28 16:28:13 +02:00
|
|
|
).
|
2023-10-19 12:19:10 +02:00
|
|
|
Builder(), nil
|
2021-02-22 14:08:47 +01:00
|
|
|
}
|