mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
45 lines
1.4 KiB
Go
45 lines
1.4 KiB
Go
|
package view
|
||
|
|
||
|
import (
|
||
|
"github.com/caos/zitadel/internal/eventstore/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 (
|
||
|
mailTemplateTable = "adminapi.mail_templates"
|
||
|
)
|
||
|
|
||
|
func (v *View) MailTemplateByAggregateID(aggregateID string) (*model.MailTemplateView, error) {
|
||
|
return view.GetMailTemplateByAggregateID(v.Db, mailTemplateTable, aggregateID)
|
||
|
}
|
||
|
|
||
|
func (v *View) PutMailTemplate(template *model.MailTemplateView, event *models.Event) error {
|
||
|
err := view.PutMailTemplate(v.Db, mailTemplateTable, template)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return v.ProcessedMailTemplateSequence(event)
|
||
|
}
|
||
|
|
||
|
func (v *View) GetLatestMailTemplateSequence() (*global_view.CurrentSequence, error) {
|
||
|
return v.latestSequence(mailTemplateTable)
|
||
|
}
|
||
|
|
||
|
func (v *View) ProcessedMailTemplateSequence(event *models.Event) error {
|
||
|
return v.saveCurrentSequence(mailTemplateTable, event)
|
||
|
}
|
||
|
|
||
|
func (v *View) UpdateMailTemplateSpoolerRunTimestamp() error {
|
||
|
return v.updateSpoolerRunSequence(mailTemplateTable)
|
||
|
}
|
||
|
|
||
|
func (v *View) GetLatestMailTemplateFailedEvent(sequence uint64) (*global_view.FailedEvent, error) {
|
||
|
return v.latestFailedEvent(mailTemplateTable, sequence)
|
||
|
}
|
||
|
|
||
|
func (v *View) ProcessedMailTemplateFailedEvent(failedEvent *global_view.FailedEvent) error {
|
||
|
return v.saveFailedEvent(failedEvent)
|
||
|
}
|