feat: text query (#2735)

* feat: change mail template to new query side

* feat: adminapi message text

* feat: adminapi message text

* feat: adminapi message text

* feat: message texts

* feat: admin texts

* feat: tests

* feat: tests

* feat: custom login text on adminapi

* feat: custom login text

* feat: custom login text

* feat: message text prepare test

* feat: login text texts

* feat: custom login text

* merge main

* fix go.sum

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2021-12-16 15:21:37 +01:00
committed by GitHub
parent a43e1fc34a
commit c5d6325897
53 changed files with 2250 additions and 2196 deletions

View File

@@ -92,7 +92,7 @@ func (p *CustomTextProjection) reduceSet(event eventstore.EventReader) (*handler
logging.LogWithFields("PROJE-g0Jfs", "seq", event.Sequence(), "expectedTypes", []eventstore.EventType{org.CustomTextSetEventType, iam.CustomTextSetEventType}).Error("wrong event type")
return nil, errors.ThrowInvalidArgument(nil, "PROJE-KKfw4", "reduce.wrong.event.type")
}
return crdb.NewCreateStatement(
return crdb.NewUpsertStatement(
&customTextEvent,
[]handler.Column{
handler.NewCol(CustomTextAggregateIDCol, customTextEvent.Aggregate().ID),
@@ -124,7 +124,7 @@ func (p *CustomTextProjection) reduceRemoved(event eventstore.EventReader) (*han
handler.NewCond(CustomTextAggregateIDCol, customTextEvent.Aggregate().ID),
handler.NewCond(CustomTextTemplateCol, customTextEvent.Template),
handler.NewCond(CustomTextKeyCol, customTextEvent.Key),
handler.NewCond(CustomTextLanguageCol, customTextEvent.Language),
handler.NewCond(CustomTextLanguageCol, customTextEvent.Language.String()),
}), nil
}

View File

@@ -45,7 +45,7 @@ func TestCustomTextProjection_reduces(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "INSERT INTO zitadel.projections.custom_texts (aggregate_id, creation_date, change_date, sequence, is_default, template, language, key, text) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedStmt: "UPSERT INTO zitadel.projections.custom_texts (aggregate_id, creation_date, change_date, sequence, is_default, template, language, key, text) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedArgs: []interface{}{
"agg-id",
anyArg{},
@@ -89,7 +89,7 @@ func TestCustomTextProjection_reduces(t *testing.T) {
"agg-id",
"InitCode",
"Text",
language.English,
"en",
},
},
},
@@ -152,7 +152,7 @@ func TestCustomTextProjection_reduces(t *testing.T) {
executer: &testExecuter{
executions: []execution{
{
expectedStmt: "INSERT INTO zitadel.projections.custom_texts (aggregate_id, creation_date, change_date, sequence, is_default, template, language, key, text) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedStmt: "UPSERT INTO zitadel.projections.custom_texts (aggregate_id, creation_date, change_date, sequence, is_default, template, language, key, text) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedArgs: []interface{}{
"agg-id",
anyArg{},
@@ -196,7 +196,7 @@ func TestCustomTextProjection_reduces(t *testing.T) {
"agg-id",
"InitCode",
"Text",
language.English,
"en",
},
},
},

View File

@@ -96,7 +96,7 @@ func (p *MessageTextProjection) reduceAdded(event eventstore.EventReader) (*hand
return nil, errors.ThrowInvalidArgument(nil, "PROJE-2n90r", "reduce.wrong.event.type")
}
if !isMessageTemplate(templateEvent.Template) {
return nil, nil
return crdb.NewNoOpStatement(event), nil
}
cols := []handler.Column{