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"
|
|
|
|
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
|
|
|
"github.com/zitadel/zitadel/internal/repository/project"
|
2021-02-22 14:08:47 +01:00
|
|
|
)
|
|
|
|
|
2022-04-19 08:26:12 +02:00
|
|
|
func ProjectByIDQuery(id, instanceID string, latestSequence uint64) (*es_models.SearchQuery, error) {
|
2021-02-22 14:08:47 +01:00
|
|
|
if id == "" {
|
|
|
|
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-dke74", "Errors.Project.ProjectIDMissing")
|
|
|
|
}
|
|
|
|
return es_models.NewSearchQuery().
|
2022-04-19 08:26:12 +02:00
|
|
|
AddQuery().
|
2022-05-16 15:10:10 +02:00
|
|
|
AggregateIDFilter(id).
|
2022-03-31 11:36:26 +02:00
|
|
|
AggregateTypeFilter(project.AggregateType).
|
2022-04-19 08:26:12 +02:00
|
|
|
LatestSequenceFilter(latestSequence).
|
2022-05-16 15:10:10 +02:00
|
|
|
InstanceIDFilter(instanceID).
|
|
|
|
SearchQuery(), nil
|
2021-02-22 14:08:47 +01:00
|
|
|
}
|