mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-16 12:58:00 +00:00
d8e42744b4
* fix: move eventstore pkgs * fix: move eventstore pkgs * fix: remove v2 view * fix: remove v2 view
45 lines
1.3 KiB
Go
45 lines
1.3 KiB
Go
package model
|
|
|
|
import (
|
|
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
|
|
iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model"
|
|
)
|
|
|
|
func (o *Org) appendAddMailTextEvent(event *es_models.Event) error {
|
|
mailText := &iam_es_model.MailText{}
|
|
err := mailText.SetDataLabel(event)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
mailText.ObjectRoot.CreationDate = event.CreationDate
|
|
o.MailTexts = append(o.MailTexts, mailText)
|
|
return nil
|
|
}
|
|
|
|
func (o *Org) appendChangeMailTextEvent(event *es_models.Event) error {
|
|
mailText := &iam_es_model.MailText{}
|
|
err := mailText.SetDataLabel(event)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
mailText.ObjectRoot.ChangeDate = event.CreationDate
|
|
if n, m := iam_es_model.GetMailText(o.MailTexts, mailText.MailTextType, mailText.Language); m != nil {
|
|
o.MailTexts[n] = mailText
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (o *Org) appendRemoveMailTextEvent(event *es_models.Event) error {
|
|
mailText := &iam_es_model.MailText{}
|
|
err := mailText.SetDataLabel(event)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if n, m := iam_es_model.GetMailText(o.MailTexts, mailText.MailTextType, mailText.Language); m != nil {
|
|
o.MailTexts[n] = o.MailTexts[len(o.MailTexts)-1]
|
|
o.MailTexts[len(o.MailTexts)-1] = nil
|
|
o.MailTexts = o.MailTexts[:len(o.MailTexts)-1]
|
|
}
|
|
return nil
|
|
}
|