mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:37:31 +00:00
feat: sequence and timestamp on searchrequests (#468)
* feat: reread events * feat: sequence and timestamo on search requests * feat: sequence and timestamo on search requests * fix: better naming * fix: log errors * fix: read sequence before search request
This commit is contained in:
@@ -46,7 +46,7 @@ func (n *Notification) EventQuery() (*models.SearchQuery, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return eventsourcing.UserQuery(sequence), nil
|
||||
return eventsourcing.UserQuery(sequence.CurrentSequence), nil
|
||||
}
|
||||
|
||||
func (n *Notification) Reduce(event *models.Event) (err error) {
|
||||
|
@@ -40,7 +40,7 @@ func (p *NotifyUser) EventQuery() (*models.SearchQuery, error) {
|
||||
}
|
||||
return es_models.NewSearchQuery().
|
||||
AggregateTypeFilter(es_model.UserAggregate, org_es_model.OrgAggregate).
|
||||
LatestSequenceFilter(sequence), nil
|
||||
LatestSequenceFilter(sequence.CurrentSequence), nil
|
||||
}
|
||||
|
||||
func (u *NotifyUser) Reduce(event *models.Event) (err error) {
|
||||
|
@@ -8,7 +8,7 @@ const (
|
||||
notificationTable = "notification.notifications"
|
||||
)
|
||||
|
||||
func (v *View) GetLatestNotificationSequence() (uint64, error) {
|
||||
func (v *View) GetLatestNotificationSequence() (*repository.CurrentSequence, error) {
|
||||
return v.latestSequence(notificationTable)
|
||||
}
|
||||
|
||||
|
@@ -37,7 +37,7 @@ func (v *View) DeleteNotifyUser(userID string, eventSequence uint64) error {
|
||||
return v.ProcessedNotifyUserSequence(eventSequence)
|
||||
}
|
||||
|
||||
func (v *View) GetLatestNotifyUserSequence() (uint64, error) {
|
||||
func (v *View) GetLatestNotifyUserSequence() (*repository.CurrentSequence, error) {
|
||||
return v.latestSequence(notifyUserTable)
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,6 @@ func (v *View) saveCurrentSequence(viewName string, sequence uint64) error {
|
||||
return repository.SaveCurrentSequence(v.Db, sequencesTable, viewName, sequence)
|
||||
}
|
||||
|
||||
func (v *View) latestSequence(viewName string) (uint64, error) {
|
||||
func (v *View) latestSequence(viewName string) (*repository.CurrentSequence, error) {
|
||||
return repository.LatestSequence(v.Db, sequencesTable, viewName)
|
||||
}
|
||||
|
Reference in New Issue
Block a user