mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 03:54:21 +00:00
d3e403f645
* fix: events query user * fix: events query user * user events query * fix tests * fix query * cleanup --------- Co-authored-by: Fabienne <fabienne.gerschwiler@gmail.com>
22 lines
690 B
Go
22 lines
690 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/user"
|
|
)
|
|
|
|
func UserByIDQuery(id, instanceID string, latestSequence uint64, eventTypes []es_models.EventType) (*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).
|
|
EventTypesFilter(eventTypes...).
|
|
LatestSequenceFilter(latestSequence).
|
|
InstanceIDFilter(instanceID).
|
|
SearchQuery(), nil
|
|
}
|