mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:17:32 +00:00
fix: creation date argument in search events filters (#6855)
* fix: creation date filter in event queries * fix: creation date with ordering filter * simplify code * simplify review --------- Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
@@ -25,6 +25,7 @@ type SearchQueryBuilder struct {
|
||||
positionAfter float64
|
||||
awaitOpenTransactions bool
|
||||
creationDateAfter time.Time
|
||||
creationDateBefore time.Time
|
||||
eventSequenceGreater uint64
|
||||
}
|
||||
|
||||
@@ -84,6 +85,10 @@ func (q SearchQueryBuilder) GetCreationDateAfter() time.Time {
|
||||
return q.creationDateAfter
|
||||
}
|
||||
|
||||
func (q SearchQueryBuilder) GetCreationDateBefore() time.Time {
|
||||
return q.creationDateBefore
|
||||
}
|
||||
|
||||
// ensureInstanceID makes sure that the instance id is always set
|
||||
func (b *SearchQueryBuilder) ensureInstanceID(ctx context.Context) {
|
||||
if b.instanceID == nil && authz.GetInstance(ctx).InstanceID() != "" {
|
||||
@@ -256,6 +261,15 @@ func (builder *SearchQueryBuilder) CreationDateAfter(creationDate time.Time) *Se
|
||||
return builder
|
||||
}
|
||||
|
||||
// CreationDateBefore filters for events which happened before the specified time
|
||||
func (builder *SearchQueryBuilder) CreationDateBefore(creationDate time.Time) *SearchQueryBuilder {
|
||||
if creationDate.IsZero() || creationDate.Unix() == 0 {
|
||||
return builder
|
||||
}
|
||||
builder.creationDateBefore = creationDate
|
||||
return builder
|
||||
}
|
||||
|
||||
// AddQuery creates a new sub query.
|
||||
// All fields in the sub query are AND-connected in the storage request.
|
||||
// Multiple sub queries are OR-connected in the storage request.
|
||||
|
Reference in New Issue
Block a user