fix: template removed events on projections (#2863)

This commit is contained in:
Livio Amstutz 2021-12-17 09:31:39 +01:00 committed by GitHub
parent cc04067da3
commit 28d7acdf99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"github.com/caos/logging" "github.com/caos/logging"
"github.com/caos/zitadel/internal/errors" "github.com/caos/zitadel/internal/errors"
"github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/eventstore"
"github.com/caos/zitadel/internal/eventstore/handler" "github.com/caos/zitadel/internal/eventstore/handler"
@ -144,6 +145,6 @@ func (p *CustomTextProjection) reduceTemplateRemoved(event eventstore.EventReade
[]handler.Condition{ []handler.Condition{
handler.NewCond(CustomTextAggregateIDCol, customTextEvent.Aggregate().ID), handler.NewCond(CustomTextAggregateIDCol, customTextEvent.Aggregate().ID),
handler.NewCond(CustomTextTemplateCol, customTextEvent.Template), handler.NewCond(CustomTextTemplateCol, customTextEvent.Template),
handler.NewCond(CustomTextLanguageCol, customTextEvent.Language), handler.NewCond(CustomTextLanguageCol, customTextEvent.Language.String()),
}), nil }), nil
} }

View File

@ -9,7 +9,6 @@ import (
"github.com/caos/zitadel/internal/eventstore/repository" "github.com/caos/zitadel/internal/eventstore/repository"
"github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/repository/iam"
"github.com/caos/zitadel/internal/repository/org" "github.com/caos/zitadel/internal/repository/org"
"golang.org/x/text/language"
) )
func TestCustomTextProjection_reduces(t *testing.T) { func TestCustomTextProjection_reduces(t *testing.T) {
@ -122,7 +121,7 @@ func TestCustomTextProjection_reduces(t *testing.T) {
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"InitCode", "InitCode",
language.English, "en",
}, },
}, },
}, },
@ -229,7 +228,7 @@ func TestCustomTextProjection_reduces(t *testing.T) {
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"InitCode", "InitCode",
language.English, "en",
}, },
}, },
}, },

View File

@ -10,7 +10,6 @@ import (
"github.com/caos/zitadel/internal/eventstore/repository" "github.com/caos/zitadel/internal/eventstore/repository"
"github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/repository/iam"
"github.com/caos/zitadel/internal/repository/org" "github.com/caos/zitadel/internal/repository/org"
"golang.org/x/text/language"
) )
func TestMessageTextProjection_reduces(t *testing.T) { func TestMessageTextProjection_reduces(t *testing.T) {
@ -574,7 +573,7 @@ func TestMessageTextProjection_reduces(t *testing.T) {
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"InitCode", "InitCode",
language.English, "en",
}, },
}, },
}, },

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"github.com/caos/logging" "github.com/caos/logging"
"github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/domain"
"github.com/caos/zitadel/internal/errors" "github.com/caos/zitadel/internal/errors"
"github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/eventstore"
@ -198,7 +199,7 @@ func (p *MessageTextProjection) reduceTemplateRemoved(event eventstore.EventRead
[]handler.Condition{ []handler.Condition{
handler.NewCond(MessageTextAggregateIDCol, templateEvent.Aggregate().ID), handler.NewCond(MessageTextAggregateIDCol, templateEvent.Aggregate().ID),
handler.NewCond(MessageTextTypeCol, templateEvent.Template), handler.NewCond(MessageTextTypeCol, templateEvent.Template),
handler.NewCond(MessageTextLanguageCol, templateEvent.Language), handler.NewCond(MessageTextLanguageCol, templateEvent.Language.String()),
}, },
), nil ), nil
} }