mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:17:32 +00:00
feat: set up org (#1157)
* add setup steps * refactoring * omitempty * cleanup * begin org * create org * setup org * setup org * merge * fixes * fixes * fixes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package eventstore
|
||||
|
||||
type aggregater interface {
|
||||
type Aggregater interface {
|
||||
//ID returns the aggreagte id
|
||||
ID() string
|
||||
//KeyType returns the aggregate type
|
||||
@@ -52,7 +52,7 @@ func AggregateFromWriteModel(
|
||||
}
|
||||
}
|
||||
|
||||
//Aggregate is the basic implementation of aggregater
|
||||
//Aggregate is the basic implementation of Aggregater
|
||||
type Aggregate struct {
|
||||
id string `json:"-"`
|
||||
typ AggregateType `json:"-"`
|
||||
@@ -69,32 +69,32 @@ func (a *Aggregate) PushEvents(events ...EventPusher) *Aggregate {
|
||||
return a
|
||||
}
|
||||
|
||||
//ID implements aggregater
|
||||
//ID implements Aggregater
|
||||
func (a *Aggregate) ID() string {
|
||||
return a.id
|
||||
}
|
||||
|
||||
//KeyType implements aggregater
|
||||
//KeyType implements Aggregater
|
||||
func (a *Aggregate) Type() AggregateType {
|
||||
return a.typ
|
||||
}
|
||||
|
||||
//Events implements aggregater
|
||||
//Events implements Aggregater
|
||||
func (a *Aggregate) Events() []EventPusher {
|
||||
return a.events
|
||||
}
|
||||
|
||||
//ResourceOwner implements aggregater
|
||||
//ResourceOwner implements Aggregater
|
||||
func (a *Aggregate) ResourceOwner() string {
|
||||
return a.resourceOwner
|
||||
}
|
||||
|
||||
//Version implements aggregater
|
||||
//Version implements Aggregater
|
||||
func (a *Aggregate) Version() Version {
|
||||
return a.version
|
||||
}
|
||||
|
||||
//PreviousSequence implements aggregater
|
||||
//PreviousSequence implements Aggregater
|
||||
func (a *Aggregate) PreviousSequence() uint64 {
|
||||
return a.previousSequence
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ func (es *Eventstore) Health(ctx context.Context) error {
|
||||
}
|
||||
|
||||
//PushAggregate pushes the aggregate and reduces the new events on the aggregate
|
||||
func (es *Eventstore) PushAggregate(ctx context.Context, writeModel queryReducer, aggregate aggregater) error {
|
||||
func (es *Eventstore) PushAggregate(ctx context.Context, writeModel queryReducer, aggregate Aggregater) error {
|
||||
events, err := es.PushAggregates(ctx, aggregate)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -49,7 +49,7 @@ func (es *Eventstore) PushAggregate(ctx context.Context, writeModel queryReducer
|
||||
|
||||
//PushAggregates maps the events of all aggregates to an eventstore event
|
||||
// based on the pushMapper
|
||||
func (es *Eventstore) PushAggregates(ctx context.Context, aggregates ...aggregater) ([]EventReader, error) {
|
||||
func (es *Eventstore) PushAggregates(ctx context.Context, aggregates ...Aggregater) ([]EventReader, error) {
|
||||
events, err := es.aggregatesToEvents(aggregates)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -63,7 +63,7 @@ func (es *Eventstore) PushAggregates(ctx context.Context, aggregates ...aggregat
|
||||
return es.mapEvents(events)
|
||||
}
|
||||
|
||||
func (es *Eventstore) aggregatesToEvents(aggregates []aggregater) ([]*repository.Event, error) {
|
||||
func (es *Eventstore) aggregatesToEvents(aggregates []Aggregater) ([]*repository.Event, error) {
|
||||
events := make([]*repository.Event, 0, len(aggregates))
|
||||
for _, aggregate := range aggregates {
|
||||
var previousEvent *repository.Event
|
||||
|
@@ -356,7 +356,7 @@ func Test_eventData(t *testing.T) {
|
||||
|
||||
func TestEventstore_aggregatesToEvents(t *testing.T) {
|
||||
type args struct {
|
||||
aggregates []aggregater
|
||||
aggregates []Aggregater
|
||||
}
|
||||
type res struct {
|
||||
wantErr bool
|
||||
@@ -370,7 +370,7 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
|
||||
{
|
||||
name: "one aggregate one event",
|
||||
args: args{
|
||||
aggregates: []aggregater{
|
||||
aggregates: []Aggregater{
|
||||
&testAggregate{
|
||||
id: "1",
|
||||
events: []EventPusher{
|
||||
@@ -403,7 +403,7 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
|
||||
{
|
||||
name: "one aggregate multiple events",
|
||||
args: args{
|
||||
aggregates: []aggregater{
|
||||
aggregates: []Aggregater{
|
||||
&testAggregate{
|
||||
id: "1",
|
||||
events: []EventPusher{
|
||||
@@ -452,7 +452,7 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
|
||||
{
|
||||
name: "invalid data",
|
||||
args: args{
|
||||
aggregates: []aggregater{
|
||||
aggregates: []Aggregater{
|
||||
&testAggregate{
|
||||
id: "1",
|
||||
events: []EventPusher{
|
||||
@@ -473,7 +473,7 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
|
||||
{
|
||||
name: "multiple aggregates",
|
||||
args: args{
|
||||
aggregates: []aggregater{
|
||||
aggregates: []Aggregater{
|
||||
&testAggregate{
|
||||
id: "1",
|
||||
events: []EventPusher{
|
||||
@@ -614,7 +614,7 @@ func (repo *testRepo) LatestSequence(ctx context.Context, queryFactory *reposito
|
||||
|
||||
func TestEventstore_Push(t *testing.T) {
|
||||
type args struct {
|
||||
aggregates []aggregater
|
||||
aggregates []Aggregater
|
||||
}
|
||||
type fields struct {
|
||||
repo *testRepo
|
||||
@@ -632,7 +632,7 @@ func TestEventstore_Push(t *testing.T) {
|
||||
{
|
||||
name: "one aggregate one event",
|
||||
args: args{
|
||||
aggregates: []aggregater{
|
||||
aggregates: []Aggregater{
|
||||
&testAggregate{
|
||||
id: "1",
|
||||
events: []EventPusher{
|
||||
@@ -672,7 +672,7 @@ func TestEventstore_Push(t *testing.T) {
|
||||
{
|
||||
name: "one aggregate multiple events",
|
||||
args: args{
|
||||
aggregates: []aggregater{
|
||||
aggregates: []Aggregater{
|
||||
&testAggregate{
|
||||
id: "1",
|
||||
events: []EventPusher{
|
||||
@@ -731,7 +731,7 @@ func TestEventstore_Push(t *testing.T) {
|
||||
{
|
||||
name: "multiple aggregates",
|
||||
args: args{
|
||||
aggregates: []aggregater{
|
||||
aggregates: []Aggregater{
|
||||
&testAggregate{
|
||||
id: "1",
|
||||
events: []EventPusher{
|
||||
@@ -815,7 +815,7 @@ func TestEventstore_Push(t *testing.T) {
|
||||
{
|
||||
name: "push fails",
|
||||
args: args{
|
||||
aggregates: []aggregater{
|
||||
aggregates: []Aggregater{
|
||||
&testAggregate{
|
||||
id: "1",
|
||||
events: []EventPusher{
|
||||
@@ -842,7 +842,7 @@ func TestEventstore_Push(t *testing.T) {
|
||||
{
|
||||
name: "aggreagtes to events mapping fails",
|
||||
args: args{
|
||||
aggregates: []aggregater{
|
||||
aggregates: []Aggregater{
|
||||
&testAggregate{
|
||||
id: "1",
|
||||
events: []EventPusher{
|
||||
|
Reference in New Issue
Block a user