mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 05:57:32 +00:00
36 lines
672 B
Go
36 lines
672 B
Go
package org
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
)
|
|
|
|
const (
|
|
orgEventTypePrefix = eventstore.EventType("org.")
|
|
)
|
|
|
|
const (
|
|
AggregateType = "org"
|
|
AggregateVersion = "v1"
|
|
)
|
|
|
|
type Aggregate struct {
|
|
eventstore.Aggregate
|
|
}
|
|
|
|
func NewAggregate(id string) *Aggregate {
|
|
return &Aggregate{
|
|
Aggregate: eventstore.Aggregate{
|
|
Type: AggregateType,
|
|
Version: AggregateVersion,
|
|
ID: id,
|
|
ResourceOwner: id,
|
|
},
|
|
}
|
|
}
|
|
|
|
func AggregateFromWriteModel(ctx context.Context, wm *eventstore.WriteModel) *eventstore.Aggregate {
|
|
return eventstore.AggregateFromWriteModelCtx(ctx, wm, AggregateType, AggregateVersion)
|
|
}
|