mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
fcf81bed5f
* fix(management): search user grants with granted * fix(auth): handle user grant project owner * fix: grantowner to resourceowner * fix: generate mock * fix: mig * fix: query correct columns * fix: remove new line * fix: dont overwrite resourceowner on appendevent
33 lines
633 B
Go
33 lines
633 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type ObjectRoot struct {
|
|
AggregateID string `json:"-"`
|
|
Sequence uint64 `json:"-"`
|
|
ResourceOwner string `json:"-"`
|
|
CreationDate time.Time `json:"-"`
|
|
ChangeDate time.Time `json:"-"`
|
|
}
|
|
|
|
func (o *ObjectRoot) AppendEvent(event *Event) {
|
|
if o.AggregateID == "" {
|
|
o.AggregateID = event.AggregateID
|
|
}
|
|
if o.ResourceOwner == "" {
|
|
o.ResourceOwner = event.ResourceOwner
|
|
}
|
|
|
|
o.ChangeDate = event.CreationDate
|
|
if event.PreviousSequence == 0 {
|
|
o.CreationDate = o.ChangeDate
|
|
}
|
|
|
|
o.Sequence = event.Sequence
|
|
}
|
|
func (o *ObjectRoot) IsZero() bool {
|
|
return o.AggregateID == ""
|
|
}
|