zitadel/internal/management/repository/eventsourcing/view/custom_texts.go
Max Peintner 2e684684de
feat(console): message and login texts, privacy policy (#2016)
* message texts wrapper components

* message-text sub, i18n, grid

* fix routing

* pack

* pack

* update material

* audit

* fix mgmt service for labelplcy

* map conv

* edit text from map

* request map

* fetch data, mgmt admin service

* warn box, i18n

* resetbtn

* login texts

* login text requests

* reset, default, i18n

* disabled, features, message text setter, service

* locale switcher

* policy grid

* password reset, domain claimed i18n

* lint files

* fix admin service, i18n, lang setter

* fix scss duplicate

* privacy policy, cleanup grid, fix message, login texts (#2031)

* policy grid everywhere 🦒

* cleanup home

* log login text request

* patch all data

* refresh toggle

* fix: add dialog for unsaved changes (#2057)

* logintexts dialog

* check for dialog on pairwise operation

* fix: patch value to local state after save

* fix: i18n and custom login texts (#2060)

* fix: i18n and custom login texts

* fix: tos and privacy texts

* fix frontend

* fix: tos and privacy texts and tests

* fix: i18n, tos and privacy texts and tests

* fix frontend maps

* i18n

* add ResetCustomLoginTextToDefault in admin api and fix template remove in handlers

* resetlogintexttodefault

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2021-07-26 12:44:45 +02:00

66 lines
2.2 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 (
customTextTable = "management.custom_texts"
)
func (v *View) CustomTextByIDs(aggregateID, template, lang, key string) (*model.CustomTextView, error) {
return view.CustomTextByIDs(v.Db, customTextTable, aggregateID, template, lang, key)
}
func (v *View) CustomTextsByAggregateIDAndTemplateAndLand(aggregateID, template, lang string) ([]*model.CustomTextView, error) {
return view.GetCustomTexts(v.Db, customTextTable, aggregateID, template, lang)
}
func (v *View) PutCustomText(template *model.CustomTextView, event *models.Event) error {
err := view.PutCustomText(v.Db, customTextTable, template)
if err != nil {
return err
}
return v.ProcessedCustomTextSequence(event)
}
func (v *View) DeleteCustomText(aggregateID, textType, lang, key string, event *models.Event) error {
err := view.DeleteCustomText(v.Db, customTextTable, aggregateID, textType, lang, key)
if err != nil && !errors.IsNotFound(err) {
return err
}
return v.ProcessedCustomTextSequence(event)
}
func (v *View) DeleteCustomTextTemplate(aggregateID, textType, lang string, event *models.Event) error {
err := view.DeleteCustomTextTemplate(v.Db, customTextTable, aggregateID, textType, lang)
if err != nil && !errors.IsNotFound(err) {
return err
}
return v.ProcessedCustomTextSequence(event)
}
func (v *View) GetLatestCustomTextSequence() (*global_view.CurrentSequence, error) {
return v.latestSequence(customTextTable)
}
func (v *View) ProcessedCustomTextSequence(event *models.Event) error {
return v.saveCurrentSequence(customTextTable, event)
}
func (v *View) UpdateCustomTextSpoolerRunTimestamp() error {
return v.updateSpoolerRunSequence(customTextTable)
}
func (v *View) GetLatestCustomTextFailedEvent(sequence uint64) (*global_view.FailedEvent, error) {
return v.latestFailedEvent(customTextTable, sequence)
}
func (v *View) ProcessedCustomTextFailedEvent(failedEvent *global_view.FailedEvent) error {
return v.saveFailedEvent(failedEvent)
}