mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-07 04:04:31 +00:00
fix(event handling): use internal pubsub for view update (#1118)
* start sub * start implement subsciptions * start subscription * implementation for member done * admin done * fix: tests * extend handlers * prepary notification * no errors in adminapi * changed current sequence in all packages * ignore mocks * works * subscriptions as singleton * tests * refactor: rename function scope var
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package view
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/eventstore/models"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/user/repository/view"
|
||||
"github.com/caos/zitadel/internal/user/repository/view/model"
|
||||
"github.com/caos/zitadel/internal/view/repository"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -24,39 +24,39 @@ func (v *View) SearchMachineKeys(request *usr_model.MachineKeySearchRequest) ([]
|
||||
return view.SearchMachineKeys(v.Db, machineKeyTable, request)
|
||||
}
|
||||
|
||||
func (v *View) PutMachineKey(org *model.MachineKeyView, sequence uint64, eventTimestamp time.Time) error {
|
||||
func (v *View) PutMachineKey(org *model.MachineKeyView, event *models.Event) error {
|
||||
err := view.PutMachineKey(v.Db, machineKeyTable, org)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if sequence != 0 {
|
||||
return v.ProcessedMachineKeySequence(sequence, eventTimestamp)
|
||||
if event.Sequence != 0 {
|
||||
return v.ProcessedMachineKeySequence(event)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *View) DeleteMachineKey(keyID string, eventSequence uint64, eventTimestamp time.Time) error {
|
||||
func (v *View) DeleteMachineKey(keyID string, event *models.Event) error {
|
||||
err := view.DeleteMachineKey(v.Db, machineKeyTable, keyID)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return v.ProcessedMachineKeySequence(eventSequence, eventTimestamp)
|
||||
return v.ProcessedMachineKeySequence(event)
|
||||
}
|
||||
|
||||
func (v *View) DeleteMachineKeysByUserID(userID string, eventSequence uint64, eventTimestamp time.Time) error {
|
||||
func (v *View) DeleteMachineKeysByUserID(userID string, event *models.Event) error {
|
||||
err := view.DeleteMachineKey(v.Db, machineKeyTable, userID)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return v.ProcessedMachineKeySequence(eventSequence, eventTimestamp)
|
||||
return v.ProcessedMachineKeySequence(event)
|
||||
}
|
||||
|
||||
func (v *View) GetLatestMachineKeySequence() (*repository.CurrentSequence, error) {
|
||||
return v.latestSequence(machineKeyTable)
|
||||
func (v *View) GetLatestMachineKeySequence(aggregateType string) (*repository.CurrentSequence, error) {
|
||||
return v.latestSequence(machineKeyTable, aggregateType)
|
||||
}
|
||||
|
||||
func (v *View) ProcessedMachineKeySequence(eventSequence uint64, eventTimestamp time.Time) error {
|
||||
return v.saveCurrentSequence(machineKeyTable, eventSequence, eventTimestamp)
|
||||
func (v *View) ProcessedMachineKeySequence(event *models.Event) error {
|
||||
return v.saveCurrentSequence(machineKeyTable, event)
|
||||
}
|
||||
|
||||
func (v *View) UpdateMachineKeySpoolerRunTimestamp() error {
|
||||
|
||||
Reference in New Issue
Block a user