mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 20:08:02 +00:00
d1284082a1
* fix: remove console log * fix: remove todos * fix: setup uniqueness * fix: setup uniqueness
35 lines
1014 B
Go
35 lines
1014 B
Go
package view
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
|
"github.com/caos/zitadel/internal/view/repository"
|
|
)
|
|
|
|
const (
|
|
sequencesTable = "notification.current_sequences"
|
|
)
|
|
|
|
func (v *View) saveCurrentSequence(viewName string, event *models.Event) error {
|
|
return repository.SaveCurrentSequence(v.Db, sequencesTable, viewName, event.Sequence, event.CreationDate)
|
|
}
|
|
|
|
func (v *View) latestSequence(viewName string) (*repository.CurrentSequence, error) {
|
|
return repository.LatestSequence(v.Db, sequencesTable, viewName)
|
|
}
|
|
|
|
func (v *View) updateSpoolerRunSequence(viewName string) error {
|
|
currentSequence, err := repository.LatestSequence(v.Db, sequencesTable, viewName)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if currentSequence.ViewName == "" {
|
|
currentSequence.ViewName = viewName
|
|
}
|
|
currentSequence.LastSuccessfulSpoolerRun = time.Now()
|
|
//update all aggregate types
|
|
currentSequence.AggregateType = ""
|
|
return repository.UpdateCurrentSequence(v.Db, sequencesTable, currentSequence)
|
|
}
|