mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 16:27:32 +00:00
chore: move the go code into a subfolder
This commit is contained in:
49
apps/api/internal/domain/org.go
Normal file
49
apps/api/internal/domain/org.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
||||
)
|
||||
|
||||
type Org struct {
|
||||
models.ObjectRoot
|
||||
|
||||
State OrgState
|
||||
Name string
|
||||
|
||||
PrimaryDomain string
|
||||
Domains []*OrgDomain
|
||||
}
|
||||
|
||||
func (o *Org) IsValid() bool {
|
||||
if o == nil {
|
||||
return false
|
||||
}
|
||||
o.Name = strings.TrimSpace(o.Name)
|
||||
return o.Name != ""
|
||||
}
|
||||
|
||||
func (o *Org) AddIAMDomain(iamDomain string) {
|
||||
orgDomain, _ := NewIAMDomainName(o.Name, iamDomain)
|
||||
o.Domains = append(o.Domains, &OrgDomain{Domain: orgDomain, Verified: true, Primary: true})
|
||||
}
|
||||
|
||||
type OrgState int32
|
||||
|
||||
const (
|
||||
OrgStateUnspecified OrgState = iota
|
||||
OrgStateActive
|
||||
OrgStateInactive
|
||||
OrgStateRemoved
|
||||
|
||||
orgStateMax
|
||||
)
|
||||
|
||||
func (s OrgState) Valid() bool {
|
||||
return s > OrgStateUnspecified && s < orgStateMax
|
||||
}
|
||||
|
||||
func (s OrgState) Exists() bool {
|
||||
return s != OrgStateRemoved && s != OrgStateUnspecified
|
||||
}
|
Reference in New Issue
Block a user