Files
zitadel/backend/v3/domain/organization_domain.go

74 lines
3.0 KiB
Go
Raw Normal View History

2025-07-16 09:26:46 +02:00
package domain
import (
"context"
2025-07-16 18:36:21 +02:00
"time"
2025-07-16 09:26:46 +02:00
"github.com/zitadel/zitadel/backend/v3/storage/database"
)
type OrganizationDomain struct {
2025-07-23 09:47:04 +02:00
InstanceID string `json:"instanceId,omitempty" db:"instance_id"`
OrgID string `json:"orgId,omitempty" db:"org_id"`
Domain string `json:"domain,omitempty" db:"domain"`
IsVerified bool `json:"isVerified,omitempty" db:"is_verified"`
IsPrimary bool `json:"isPrimary,omitempty" db:"is_primary"`
2025-07-22 19:09:56 +02:00
ValidationType DomainValidationType `json:"validationType,omitempty" db:"validation_type"`
2025-07-16 09:26:46 +02:00
CreatedAt string `json:"createdAt,omitempty" db:"created_at"`
UpdatedAt string `json:"updatedAt,omitempty" db:"updated_at"`
}
type AddOrganizationDomain struct {
2025-07-23 09:47:04 +02:00
InstanceID string `json:"instanceId,omitempty" db:"instance_id"`
OrgID string `json:"orgId,omitempty" db:"org_id"`
Domain string `json:"domain,omitempty" db:"domain"`
IsVerified bool `json:"isVerified,omitempty" db:"is_verified"`
IsPrimary bool `json:"isPrimary,omitempty" db:"is_primary"`
2025-07-22 19:09:56 +02:00
ValidationType DomainValidationType `json:"validationType,omitempty" db:"validation_type"`
2025-07-16 18:36:21 +02:00
// CreatedAt is the time when the domain was added.
// It is set by the repository and should not be set by the caller.
CreatedAt time.Time `json:"createdAt,omitzero" db:"created_at"`
// UpdatedAt is the time when the domain was added.
// It is set by the repository and should not be set by the caller.
UpdatedAt time.Time `json:"updatedAt,omitzero" db:"updated_at"`
2025-07-16 09:26:46 +02:00
}
type organizationDomainColumns interface {
domainColumns
// OrgIDColumn returns the column for the org id field.
2025-07-22 19:09:56 +02:00
OrgIDColumn(qualified bool) database.Column
2025-07-16 09:26:46 +02:00
}
type organizationDomainConditions interface {
domainConditions
// OrgIDCondition returns a filter on the org id field.
OrgIDCondition(orgID string) database.Condition
}
type organizationDomainChanges interface {
domainChanges
}
type OrganizationDomainRepository interface {
organizationDomainColumns
organizationDomainConditions
organizationDomainChanges
2025-07-17 15:32:50 +02:00
// Get returns a single domain based on the criteria.
// If no domain is found, it returns an error of type [database.ErrNotFound].
// If multiple domains are found, it returns an error of type [database.ErrMultipleRows].
Get(ctx context.Context, opts ...database.QueryOption) (*OrganizationDomain, error)
// List returns a list of domains based on the criteria.
// If no domains are found, it returns an empty slice.
List(ctx context.Context, opts ...database.QueryOption) ([]*OrganizationDomain, error)
2025-07-16 09:26:46 +02:00
// Add adds a new domain to the organization.
Add(ctx context.Context, domain *AddOrganizationDomain) error
// Update updates an existing domain in the organization.
2025-07-16 18:36:21 +02:00
Update(ctx context.Context, condition database.Condition, changes ...database.Change) (int64, error)
2025-07-16 09:26:46 +02:00
// Remove removes a domain from the organization.
2025-07-16 18:36:21 +02:00
Remove(ctx context.Context, condition database.Condition) (int64, error)
2025-07-16 09:26:46 +02:00
}