fix: change to repository event types and removed unused code (#3386)

* fix: change to repository event types and removed unused code

* some fixes

* remove unused code
This commit is contained in:
Livio Amstutz
2022-03-31 11:36:26 +02:00
committed by GitHub
parent 55af4a18a2
commit 87560157c1
170 changed files with 999 additions and 9581 deletions

View File

@@ -1,11 +1,9 @@
package view
import (
"time"
"github.com/caos/zitadel/internal/errors"
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
"github.com/caos/zitadel/internal/user/repository/eventsourcing/model"
"github.com/caos/zitadel/internal/repository/user"
)
func UserByIDQuery(id string, latestSequence uint64) (*es_models.SearchQuery, error) {
@@ -18,22 +16,6 @@ func UserByIDQuery(id string, latestSequence uint64) (*es_models.SearchQuery, er
func UserQuery(latestSequence uint64) *es_models.SearchQuery {
return es_models.NewSearchQuery().
AggregateTypeFilter(model.UserAggregate).
AggregateTypeFilter(user.AggregateType).
LatestSequenceFilter(latestSequence)
}
func ChangesQuery(userID string, latestSequence, limit uint64, sortAscending bool, retention time.Duration) *es_models.SearchQuery {
query := es_models.NewSearchQuery().
AggregateTypeFilter(model.UserAggregate)
if !sortAscending {
query.OrderDesc()
}
if retention > 0 {
query.CreationDateNewerFilter(time.Now().Add(-retention))
}
query.LatestSequenceFilter(latestSequence).
AggregateIDFilter(userID).
SetLimit(limit)
return query
}