refactor(v2): init events (#7823)

creates events structures for initial projections and read models
This commit is contained in:
Silvan
2024-05-23 06:36:08 +02:00
committed by GitHub
parent f37113194d
commit 12be21a3ff
56 changed files with 1952 additions and 316 deletions

36
internal/v2/org/state.go Normal file
View File

@@ -0,0 +1,36 @@
package org
type State uint8
const (
UndefinedState State = iota
ActiveState
InactiveState
RemovedState
maxState
)
func (s State) IsValid() bool {
return s != UndefinedState ||
s < maxState
}
func (s State) Is(state State) bool {
return s == state
}
func (s State) IsValidState(state State) bool {
return s.IsValid() && s.Is(state)
}
func (s State) IsValidStates(states ...State) bool {
if !s.IsValid() {
return false
}
for _, state := range states {
if s.Is(state) {
return true
}
}
return false
}