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