mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-16 21:08:00 +00:00
28 lines
731 B
Go
28 lines
731 B
Go
|
package handlers
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/zitadel/zitadel/internal/eventstore"
|
||
|
"github.com/zitadel/zitadel/internal/repository/user"
|
||
|
)
|
||
|
|
||
|
func (n *NotificationQueries) IsAlreadyHandled(ctx context.Context, event eventstore.Event, data map[string]interface{}, eventTypes ...eventstore.EventType) (bool, error) {
|
||
|
events, err := n.es.Filter(
|
||
|
ctx,
|
||
|
eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent).
|
||
|
InstanceID(event.Aggregate().InstanceID).
|
||
|
AddQuery().
|
||
|
AggregateTypes(user.AggregateType).
|
||
|
AggregateIDs(event.Aggregate().ID).
|
||
|
SequenceGreater(event.Sequence()).
|
||
|
EventTypes(eventTypes...).
|
||
|
EventData(data).
|
||
|
Builder(),
|
||
|
)
|
||
|
if err != nil {
|
||
|
return false, err
|
||
|
}
|
||
|
return len(events) > 0, nil
|
||
|
}
|