Fabi d8e42744b4
fix: move v2 pkgs (#1331)
* fix: move eventstore pkgs

* fix: move eventstore pkgs

* fix: remove v2 view

* fix: remove v2 view
2021-02-23 15:13:04 +01:00

49 lines
1.5 KiB
Go

package view
import (
"github.com/caos/zitadel/internal/eventstore/v1/models"
"github.com/caos/zitadel/internal/iam/repository/view"
"github.com/caos/zitadel/internal/iam/repository/view/model"
global_view "github.com/caos/zitadel/internal/view/repository"
)
const (
mailTextTable = "adminapi.mail_texts"
)
func (v *View) MailTexts(aggregateID string) ([]*model.MailTextView, error) {
return view.GetMailTexts(v.Db, mailTextTable, aggregateID)
}
func (v *View) MailTextByIDs(aggregateID string, textType string, language string) (*model.MailTextView, error) {
return view.GetMailTextByIDs(v.Db, mailTextTable, aggregateID, textType, language)
}
func (v *View) PutMailText(template *model.MailTextView, event *models.Event) error {
err := view.PutMailText(v.Db, mailTextTable, template)
if err != nil {
return err
}
return v.ProcessedMailTextSequence(event)
}
func (v *View) GetLatestMailTextSequence() (*global_view.CurrentSequence, error) {
return v.latestSequence(mailTextTable)
}
func (v *View) ProcessedMailTextSequence(event *models.Event) error {
return v.saveCurrentSequence(mailTextTable, event)
}
func (v *View) UpdateMailTextSpoolerRunTimestamp() error {
return v.updateSpoolerRunSequence(mailTextTable)
}
func (v *View) GetLatestMailTextFailedEvent(sequence uint64) (*global_view.FailedEvent, error) {
return v.latestFailedEvent(mailTextTable, sequence)
}
func (v *View) ProcessedMailTextFailedEvent(failedEvent *global_view.FailedEvent) error {
return v.saveFailedEvent(failedEvent)
}