zitadel/internal/project/model/application.go
Livio Amstutz 87560157c1
fix: change to repository event types and removed unused code (#3386)
* fix: change to repository event types and removed unused code

* some fixes

* remove unused code
2022-03-31 11:36:26 +02:00

50 lines
789 B
Go

package model
import (
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
)
type Application struct {
es_models.ObjectRoot
AppID string
State AppState
Name string
Type AppType
OIDCConfig *OIDCConfig
APIConfig *APIConfig
}
type AppState int32
const (
AppStateActive AppState = iota
AppStateInactive
AppStateRemoved
)
type AppType int32
const (
AppTypeUnspecified AppType = iota
AppTypeOIDC
AppTypeSAML
AppTypeAPI
)
func (a *Application) IsValid(includeConfig bool) bool {
if a.Name == "" || a.AggregateID == "" {
return false
}
if !includeConfig {
return true
}
if a.Type == AppTypeOIDC && !a.OIDCConfig.IsValid() {
return false
}
if a.Type == AppTypeAPI && !a.APIConfig.IsValid() {
return false
}
return true
}