zitadel/internal/project/repository/view/query.go
Florian Forster fa9f581d56
chore(v2): move to new org (#3499)
* chore: move to new org

* logging

* fix: org rename caos -> zitadel

Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
2022-04-26 23:01:45 +00:00

27 lines
773 B
Go

package view
import (
"github.com/zitadel/zitadel/internal/errors"
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
"github.com/zitadel/zitadel/internal/repository/project"
)
func ProjectByIDQuery(id, instanceID string, latestSequence uint64) (*es_models.SearchQuery, error) {
if id == "" {
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-dke74", "Errors.Project.ProjectIDMissing")
}
return ProjectQuery(latestSequence).
AddQuery().
AggregateIDFilter(id).
InstanceIDFilter(instanceID).
SearchQuery(), nil
}
func ProjectQuery(latestSequence uint64) *es_models.SearchQuery {
return es_models.NewSearchQuery().
AddQuery().
AggregateTypeFilter(project.AggregateType).
LatestSequenceFilter(latestSequence).
SearchQuery()
}