mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-22 15:57:34 +00:00
bdf3887f9e
* feat: default custom message text * feat: org custom message text * feat: org custom message text * feat: custom messages query side * feat: default messages * feat: message text user fields * feat: check for inactive user * feat: fix send password reset * feat: fix custom org text * feat: add variables to docs * feat: custom text tests * feat: fix notifications * feat: add custom text feature * feat: add custom text feature * feat: feature in custom message texts * feat: add custom text feature in frontend * feat: merge main * feat: feature tests * feat: change phone message in setup * fix: remove unused code, add event translation * fix: merge main and fix problems * fix: english translation file * fix: migration versions * fix: setup * feat: fix pr requests * feat: fix phone code message * feat: migration * feat: setup * fix: remove unused tests Co-authored-by: Livio Amstutz <livio.a@gmail.com>
58 lines
1.9 KiB
Go
58 lines
1.9 KiB
Go
package view
|
|
|
|
import (
|
|
"github.com/caos/zitadel/internal/errors"
|
|
"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 (
|
|
messageTextTable = "management.message_texts"
|
|
)
|
|
|
|
func (v *View) MessageTextsByAggregateID(aggregateID string) ([]*model.MessageTextView, error) {
|
|
return view.GetMessageTexts(v.Db, messageTextTable, aggregateID)
|
|
}
|
|
|
|
func (v *View) MessageTextByIDs(aggregateID, textType, lang string) (*model.MessageTextView, error) {
|
|
return view.GetMessageTextByIDs(v.Db, messageTextTable, aggregateID, textType, lang)
|
|
}
|
|
|
|
func (v *View) PutMessageText(template *model.MessageTextView, event *models.Event) error {
|
|
err := view.PutMessageText(v.Db, messageTextTable, template)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return v.ProcessedMessageTextSequence(event)
|
|
}
|
|
|
|
func (v *View) DeleteMessageText(aggregateID, textType, lang string, event *models.Event) error {
|
|
err := view.DeleteMessageText(v.Db, messageTextTable, aggregateID, textType, lang)
|
|
if err != nil && !errors.IsNotFound(err) {
|
|
return err
|
|
}
|
|
return v.ProcessedMessageTextSequence(event)
|
|
}
|
|
|
|
func (v *View) GetLatestMessageTextSequence() (*global_view.CurrentSequence, error) {
|
|
return v.latestSequence(messageTextTable)
|
|
}
|
|
|
|
func (v *View) ProcessedMessageTextSequence(event *models.Event) error {
|
|
return v.saveCurrentSequence(messageTextTable, event)
|
|
}
|
|
|
|
func (v *View) UpdateMessageTextSpoolerRunTimestamp() error {
|
|
return v.updateSpoolerRunSequence(messageTextTable)
|
|
}
|
|
|
|
func (v *View) GetLatestMessageTextFailedEvent(sequence uint64) (*global_view.FailedEvent, error) {
|
|
return v.latestFailedEvent(messageTextTable, sequence)
|
|
}
|
|
|
|
func (v *View) ProcessedMessageTextFailedEvent(failedEvent *global_view.FailedEvent) error {
|
|
return v.saveFailedEvent(failedEvent)
|
|
}
|