mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 07:57:32 +00:00
domain is defined
This commit is contained in:
@@ -15,6 +15,8 @@ var _ domain.InstanceRepository = (*instance)(nil)
|
||||
|
||||
type instance struct {
|
||||
repository
|
||||
shouldJoinDomains bool
|
||||
domainRepo domain.InstanceDomainRepository
|
||||
}
|
||||
|
||||
func InstanceRepository(client database.QueryExecutor) domain.InstanceRepository {
|
||||
@@ -244,3 +246,22 @@ func scanInstances(ctx context.Context, querier database.Querier, builder *datab
|
||||
|
||||
return instances, nil
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// sub repositories
|
||||
// -------------------------------------------------------------
|
||||
|
||||
// Domains implements [domain.InstanceRepository].
|
||||
func (i *instance) Domains() domain.InstanceDomainRepository {
|
||||
i.shouldJoinDomains = true
|
||||
|
||||
if i.domainRepo != nil {
|
||||
return i.domainRepo
|
||||
}
|
||||
|
||||
i.domainRepo = &instanceDomain{
|
||||
repository: i.repository,
|
||||
instance: i,
|
||||
}
|
||||
return i.domainRepo
|
||||
}
|
||||
|
128
backend/v3/storage/database/repository/instance_domain.go
Normal file
128
backend/v3/storage/database/repository/instance_domain.go
Normal file
@@ -0,0 +1,128 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/zitadel/zitadel/backend/v3/domain"
|
||||
"github.com/zitadel/zitadel/backend/v3/storage/database"
|
||||
)
|
||||
|
||||
var _ domain.InstanceDomainRepository = (*instanceDomain)(nil)
|
||||
|
||||
type instanceDomain struct {
|
||||
repository
|
||||
*instance
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// repository
|
||||
// -------------------------------------------------------------
|
||||
|
||||
// Add implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) Add(ctx context.Context, domain *domain.AddInstanceDomain) error {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// Remove implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) Remove(ctx context.Context, condition database.Condition) error {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// Update implements [domain.InstanceDomainRepository].
|
||||
// Subtle: this method shadows the method (instance).Update of instanceDomain.instance.
|
||||
func (i *instanceDomain) Update(ctx context.Context, condition database.Condition, changes ...database.Change) error {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// changes
|
||||
// -------------------------------------------------------------
|
||||
|
||||
// SetVerificationType implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) SetVerificationType(verificationType domain.DomainVerificationType) database.Change {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// SetPrimary implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) SetPrimary() database.Change {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// SetVerified implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) SetVerified() database.Change {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// conditions
|
||||
// -------------------------------------------------------------
|
||||
|
||||
// DomainCondition implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) DomainCondition(op database.TextOperation, domain string) database.Condition {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// InstanceIDCondition implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) InstanceIDCondition(instanceID string) database.Condition {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// IsPrimaryCondition implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) IsPrimaryCondition(isPrimary bool) database.Condition {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// IsVerifiedCondition implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) IsVerifiedCondition(isVerified bool) database.Condition {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// columns
|
||||
// -------------------------------------------------------------
|
||||
|
||||
// CreatedAtColumn implements [domain.InstanceDomainRepository].
|
||||
// Subtle: this method shadows the method (instance).CreatedAtColumn of instanceDomain.instance.
|
||||
func (i *instanceDomain) CreatedAtColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// DomainColumn implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) DomainColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// InstanceIDColumn implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) InstanceIDColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// IsPrimaryColumn implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) IsPrimaryColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// IsVerifiedColumn implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) IsVerifiedColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// UpdatedAtColumn implements [domain.InstanceDomainRepository].
|
||||
// Subtle: this method shadows the method (instance).UpdatedAtColumn of instanceDomain.instance.
|
||||
func (i *instanceDomain) UpdatedAtColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// VerificationTypeColumn implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) VerificationTypeColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// IsGeneratedColumn implements [domain.InstanceDomainRepository].
|
||||
func (i *instanceDomain) IsGeneratedColumn() database.Column {
|
||||
return database.NewColumn("is_generated")
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// scanners
|
||||
// -------------------------------------------------------------
|
@@ -18,7 +18,9 @@ import (
|
||||
var _ domain.OrganizationRepository = (*org)(nil)
|
||||
|
||||
type org struct {
|
||||
shouldJoinDomains bool
|
||||
repository
|
||||
domainRepo domain.OrganizationDomainRepository
|
||||
}
|
||||
|
||||
func OrganizationRepository(client database.QueryExecutor) domain.OrganizationRepository {
|
||||
@@ -229,6 +231,10 @@ func (org) DeletedAtColumn() database.Column {
|
||||
return database.NewColumn("deleted_at")
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// scanners
|
||||
// -------------------------------------------------------------
|
||||
|
||||
func scanOrganization(ctx context.Context, querier database.Querier, builder *database.StatementBuilder) (*domain.Organization, error) {
|
||||
rows, err := querier.Query(ctx, builder.String(), builder.Args()...)
|
||||
if err != nil {
|
||||
@@ -264,3 +270,22 @@ func scanOrganizations(ctx context.Context, querier database.Querier, builder *d
|
||||
}
|
||||
return organizations, nil
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// sub repositories
|
||||
// -------------------------------------------------------------
|
||||
|
||||
func (o *org) Domains() domain.OrganizationDomainRepository {
|
||||
o.shouldJoinDomains = true
|
||||
|
||||
if o.domainRepo != nil {
|
||||
return o.domainRepo
|
||||
}
|
||||
|
||||
o.domainRepo = &orgDomain{
|
||||
repository: o.repository,
|
||||
org: o,
|
||||
}
|
||||
|
||||
return o.domainRepo
|
||||
}
|
||||
|
@@ -4,25 +4,132 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/zitadel/zitadel/backend/v3/domain"
|
||||
"github.com/zitadel/zitadel/backend/v3/storage/database"
|
||||
)
|
||||
|
||||
var _ domain.OrganizationDomainRepository = (*orgDomain)(nil)
|
||||
|
||||
type orgDomain struct {
|
||||
repository
|
||||
*org
|
||||
}
|
||||
|
||||
// AddDomain implements [domain.DomainRepository].
|
||||
func (o *orgDomain) AddDomain(ctx context.Context, domain string) error {
|
||||
// -------------------------------------------------------------
|
||||
// repository
|
||||
// -------------------------------------------------------------
|
||||
|
||||
// Add implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) Add(ctx context.Context, domain *domain.AddOrganizationDomain) error {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// RemoveDomain implements [domain.DomainRepository].
|
||||
func (o *orgDomain) RemoveDomain(ctx context.Context, domain string) error {
|
||||
// Update implements [domain.OrganizationDomainRepository].
|
||||
// Subtle: this method shadows the method (*org).Update of orgDomain.org.
|
||||
func (o *orgDomain) Update(ctx context.Context, condition database.Condition, changes ...database.Change) error {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// SetDomainVerified implements [domain.DomainRepository].
|
||||
func (o *orgDomain) SetDomainVerified(ctx context.Context, domain string) error {
|
||||
// Remove implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) Remove(ctx context.Context, condition database.Condition) error {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
var _ domain.DomainRepository = (*orgDomain)(nil)
|
||||
// -------------------------------------------------------------
|
||||
// changes
|
||||
// -------------------------------------------------------------
|
||||
|
||||
// SetPrimary implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) SetPrimary() database.Change {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// SetVerificationType implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) SetVerificationType(verificationType domain.DomainVerificationType) database.Change {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// SetVerified implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) SetVerified() database.Change {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// conditions
|
||||
// -------------------------------------------------------------
|
||||
|
||||
// DomainCondition implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) DomainCondition(op database.TextOperation, domain string) database.Condition {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// InstanceIDCondition implements [domain.OrganizationDomainRepository].
|
||||
// Subtle: this method shadows the method (*org).InstanceIDCondition of orgDomain.org.
|
||||
func (o *orgDomain) InstanceIDCondition(instanceID string) database.Condition {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// IsPrimaryCondition implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) IsPrimaryCondition(isPrimary bool) database.Condition {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// IsVerifiedCondition implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) IsVerifiedCondition(isVerified bool) database.Condition {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// OrgIDCondition implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) OrgIDCondition(orgID string) database.Condition {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// columns
|
||||
// -------------------------------------------------------------
|
||||
|
||||
// CreatedAtColumn implements [domain.OrganizationDomainRepository].
|
||||
// Subtle: this method shadows the method (*org).CreatedAtColumn of orgDomain.org.
|
||||
func (o *orgDomain) CreatedAtColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// DomainColumn implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) DomainColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// InstanceIDColumn implements [domain.OrganizationDomainRepository].
|
||||
// Subtle: this method shadows the method (*org).InstanceIDColumn of orgDomain.org.
|
||||
func (o *orgDomain) InstanceIDColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// IsPrimaryColumn implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) IsPrimaryColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// IsVerifiedColumn implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) IsVerifiedColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// OrgIDColumn implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) OrgIDColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// UpdatedAtColumn implements [domain.OrganizationDomainRepository].
|
||||
// Subtle: this method shadows the method (*org).UpdatedAtColumn of orgDomain.org.
|
||||
func (o *orgDomain) UpdatedAtColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// VerificationTypeColumn implements [domain.OrganizationDomainRepository].
|
||||
func (o *orgDomain) VerificationTypeColumn() database.Column {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// scanners
|
||||
// -------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user