mirror of
https://github.com/zitadel/zitadel.git
synced 2025-11-14 12:53:30 +00:00
fix: rename iam to instance (#3345)
* fix: rename iam command side to instance * fix: rename iam command side to instance * fix: rename iam command side to instance * fix: rename iam command side to instance * fix: rename orgiampolicy to domain policy * fix: merge conflicts * fix: protos * fix: md files * implement deprecated org iam policy again Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
50
internal/command/instance_custom_text_model.go
Normal file
50
internal/command/instance_custom_text_model.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"golang.org/x/text/language"
|
||||
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/eventstore"
|
||||
"github.com/caos/zitadel/internal/repository/instance"
|
||||
)
|
||||
|
||||
type InstanceCustomTextWriteModel struct {
|
||||
CustomTextWriteModel
|
||||
}
|
||||
|
||||
func NewInstanceCustomTextWriteModel(key string, language language.Tag) *InstanceCustomTextWriteModel {
|
||||
return &InstanceCustomTextWriteModel{
|
||||
CustomTextWriteModel{
|
||||
WriteModel: eventstore.WriteModel{
|
||||
AggregateID: domain.IAMID,
|
||||
ResourceOwner: domain.IAMID,
|
||||
},
|
||||
Key: key,
|
||||
Language: language,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (wm *InstanceCustomTextWriteModel) AppendEvents(events ...eventstore.Event) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *instance.CustomTextSetEvent:
|
||||
wm.CustomTextWriteModel.AppendEvents(&e.CustomTextSetEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (wm *InstanceCustomTextWriteModel) Reduce() error {
|
||||
return wm.CustomTextWriteModel.Reduce()
|
||||
}
|
||||
|
||||
func (wm *InstanceCustomTextWriteModel) Query() *eventstore.SearchQueryBuilder {
|
||||
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent).
|
||||
ResourceOwner(wm.ResourceOwner).
|
||||
AddQuery().
|
||||
AggregateIDs(wm.CustomTextWriteModel.AggregateID).
|
||||
AggregateTypes(instance.AggregateType).
|
||||
EventTypes(
|
||||
instance.CustomTextSetEventType).
|
||||
Builder()
|
||||
}
|
||||
Reference in New Issue
Block a user