zitadel/internal/user/repository/view/query.go
Livio Amstutz 1305c14e49
feat: handle instanceID in projections (#3442)
* feat: handle instanceID in projections

* rename functions

* fix key lock

* fix import
2022-04-19 08:26:12 +02:00

21 lines
612 B
Go

package view
import (
"github.com/caos/zitadel/internal/errors"
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
"github.com/caos/zitadel/internal/repository/user"
)
func UserByIDQuery(id, instanceID string, latestSequence uint64) (*es_models.SearchQuery, error) {
if id == "" {
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-d8isw", "Errors.User.UserIDMissing")
}
return es_models.NewSearchQuery().
AddQuery().
AggregateTypeFilter(user.AggregateType).
AggregateIDFilter(id).
LatestSequenceFilter(latestSequence).
InstanceIDFilter(instanceID).
SearchQuery(), nil
}