mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:07:30 +00:00
fix: v2 human command (#3435)
* add/register human command done * validations * crypto * move clientid * keys * fix: clientID * remove v2 package * tests * tests running * revert old code * instance domain from ctx * chore: rename zitadel app ids * comments * fix: test
This commit is contained in:
@@ -79,7 +79,7 @@ func BaseEventFromRepo(event *repository.Event) *BaseEvent {
|
||||
ID: event.AggregateID,
|
||||
Type: AggregateType(event.AggregateType),
|
||||
ResourceOwner: event.ResourceOwner.String,
|
||||
InstanceID: event.InstanceID.String,
|
||||
InstanceID: event.InstanceID,
|
||||
Version: Version(event.Version),
|
||||
},
|
||||
EventType: EventType(event.Type),
|
||||
|
@@ -82,7 +82,7 @@ func commandsToRepository(instanceID string, cmds []Command) (events []*reposito
|
||||
AggregateID: cmd.Aggregate().ID,
|
||||
AggregateType: repository.AggregateType(cmd.Aggregate().Type),
|
||||
ResourceOwner: sql.NullString{String: cmd.Aggregate().ResourceOwner, Valid: cmd.Aggregate().ResourceOwner != ""},
|
||||
InstanceID: sql.NullString{String: instanceID, Valid: instanceID != ""},
|
||||
InstanceID: instanceID,
|
||||
EditorService: cmd.EditorService(),
|
||||
EditorUser: cmd.EditorUser(),
|
||||
Type: repository.EventType(cmd.Type()),
|
||||
@@ -178,7 +178,7 @@ func (es *Eventstore) LatestSequence(ctx context.Context, queryFactory *SearchQu
|
||||
return es.repo.LatestSequence(ctx, query)
|
||||
}
|
||||
|
||||
type queryReducer interface {
|
||||
type QueryReducer interface {
|
||||
reducer
|
||||
//Query returns the SearchQueryFactory for the events needed in reducer
|
||||
Query() *SearchQueryBuilder
|
||||
@@ -186,7 +186,7 @@ type queryReducer interface {
|
||||
|
||||
//FilterToQueryReducer filters the events based on the search query of the query function,
|
||||
// appends all events to the reducer and calls it's reduce function
|
||||
func (es *Eventstore) FilterToQueryReducer(ctx context.Context, r queryReducer) error {
|
||||
func (es *Eventstore) FilterToQueryReducer(ctx context.Context, r QueryReducer) error {
|
||||
events, err := es.Filter(ctx, r.Query())
|
||||
if err != nil {
|
||||
return err
|
||||
|
@@ -380,7 +380,7 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "caos", Valid: true},
|
||||
InstanceID: sql.NullString{String: "instanceID", Valid: true},
|
||||
InstanceID: "instanceID",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
@@ -418,7 +418,7 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "caos", Valid: true},
|
||||
InstanceID: sql.NullString{String: "instanceID", Valid: true},
|
||||
InstanceID: "instanceID",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
@@ -429,7 +429,7 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "caos", Valid: true},
|
||||
InstanceID: sql.NullString{String: "instanceID", Valid: true},
|
||||
InstanceID: "instanceID",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
@@ -585,7 +585,7 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "", Valid: false},
|
||||
InstanceID: sql.NullString{String: "zitadel"},
|
||||
InstanceID: "zitadel",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
@@ -630,7 +630,7 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "caos", Valid: true},
|
||||
InstanceID: sql.NullString{String: "zitadel"},
|
||||
InstanceID: "zitadel",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
@@ -641,7 +641,7 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "caos", Valid: true},
|
||||
InstanceID: sql.NullString{String: "zitadel"},
|
||||
InstanceID: "zitadel",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
@@ -654,7 +654,7 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "caos", Valid: true},
|
||||
InstanceID: sql.NullString{String: "zitadel"},
|
||||
InstanceID: "zitadel",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
@@ -772,7 +772,7 @@ func TestEventstore_Push(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "caos", Valid: true},
|
||||
InstanceID: sql.NullString{String: "zitadel"},
|
||||
InstanceID: "zitadel",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
@@ -816,7 +816,7 @@ func TestEventstore_Push(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "caos", Valid: true},
|
||||
InstanceID: sql.NullString{String: "zitadel"},
|
||||
InstanceID: "zitadel",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
@@ -827,7 +827,7 @@ func TestEventstore_Push(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "caos", Valid: true},
|
||||
InstanceID: sql.NullString{String: "zitadel"},
|
||||
InstanceID: "zitadel",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
@@ -882,7 +882,7 @@ func TestEventstore_Push(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "caos", Valid: true},
|
||||
InstanceID: sql.NullString{String: "zitadel"},
|
||||
InstanceID: "zitadel",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
@@ -893,7 +893,7 @@ func TestEventstore_Push(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "caos", Valid: true},
|
||||
InstanceID: sql.NullString{String: "zitadel"},
|
||||
InstanceID: "zitadel",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
@@ -906,7 +906,7 @@ func TestEventstore_Push(t *testing.T) {
|
||||
EditorService: "editorService",
|
||||
EditorUser: "editorUser",
|
||||
ResourceOwner: sql.NullString{String: "caos", Valid: true},
|
||||
InstanceID: sql.NullString{String: "zitadel"},
|
||||
InstanceID: "zitadel",
|
||||
Type: "test.event",
|
||||
Version: "v1",
|
||||
},
|
||||
|
@@ -58,7 +58,7 @@ type Event struct {
|
||||
ResourceOwner sql.NullString
|
||||
//InstanceID is the instance where this event belongs to
|
||||
// use the ID of the instance
|
||||
InstanceID sql.NullString
|
||||
InstanceID string
|
||||
}
|
||||
|
||||
//EventType is the description of the change
|
||||
|
@@ -71,7 +71,7 @@ const (
|
||||
" $7::VARCHAR AS editor_service," +
|
||||
" IFNULL((resource_owner), $8::VARCHAR) AS resource_owner," +
|
||||
" $9::VARCHAR AS instance_id," +
|
||||
" NEXTVAL(CONCAT('eventstore.', IFNULL($9, 'system'), '_seq'))," +
|
||||
" NEXTVAL(CONCAT('eventstore.', IF($9 <> '', CONCAT('i_', $9), 'system'), '_seq'))," +
|
||||
" aggregate_sequence AS previous_aggregate_sequence," +
|
||||
" aggregate_type_sequence AS previous_aggregate_type_sequence " +
|
||||
"FROM previous_data " +
|
||||
|
@@ -136,7 +136,7 @@ func Test_prepareColumns(t *testing.T) {
|
||||
},
|
||||
},
|
||||
fields: fields{
|
||||
dbRow: []interface{}{time.Time{}, repository.EventType(""), uint64(5), Sequence(0), Sequence(0), Data(nil), "", "", sql.NullString{String: ""}, sql.NullString{String: ""}, repository.AggregateType("user"), "hodor", repository.Version("")},
|
||||
dbRow: []interface{}{time.Time{}, repository.EventType(""), uint64(5), Sequence(0), Sequence(0), Data(nil), "", "", sql.NullString{String: ""}, "", repository.AggregateType("user"), "hodor", repository.Version("")},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user