Files
sendico/api/pkg/model/pbinding.go
Stephan D 62a6631b9a
All checks were successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
service backend
2025-11-07 18:35:26 +01:00

33 lines
1.3 KiB
Go

package model
import (
"go.mongodb.org/mongo-driver/bson/primitive"
)
type ScopeMode string
const (
ScopeAll ScopeMode = "all" // apply to all of that type
ScopeOnly ScopeMode = "only" // only listed IDs
ScopeAllExcept ScopeMode = "all_except" // all minus listed IDs
)
type TargetScope struct {
ObjectRefs `bson:"target" json:"target"`
Mode ScopeMode `bson:"mode" json:"mode"`
}
type PropertyInstance struct {
Global bool `bson:"global" json:"global"` // Property has single value for all property users
Required bool `bson:"required" json:"required"` // Presence requirement (works for One and Many).
UniqueAcrossEntities bool `bson:"uniqueAcrossEntities" json:"uniqueAcrossEntities"` // Uniqueness across ENTITIES (DB-level concern; enforce in assignments collection).
PropertySchemaRef primitive.ObjectID `bson:"propertySchemaRef" json:"propertySchemaRef"`
}
type PropertiesBinding struct {
PermissionBound `bson:"inline" json:"inline"`
Scope TargetScope `bson:"scope" json:"scope"`
Bindings []PropertyInstance `bson:"bindings" json:"bindings"`
ApplicableScopes []TargetScope `bson:"applicableScopes" json:"applicableScopes"`
}