tenant

package
v0.0.0-...-2147667 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register() fx.Option

func ToCreateResponse

func ToCreateResponse(response *entity.Tenant) *tenantv1.CreateTenantResponse

func ToGetResponse

func ToGetResponse(response *entity.Tenant) *tenantv1.GetTenantResponse

func ToUpdateResponse

func ToUpdateResponse(response *entity.Tenant) *tenantv1.UpdateTenantResponse

Types

type CreateTenantRequest

type CreateTenantRequest struct {
	Name                    string `json:"name"`
	Domain                  string `json:"port"`
	Timezone                string `json:"timezone"`
	SubscriptionType        int    `json:"subscription_type"`
	SelfRegistrationEnabled bool   `json:"self_registration_enabled"`
}

func ToCreateRequest

func ToCreateRequest(request *tenantv1.CreateTenantRequest) *CreateTenantRequest

type GetTenantRequest

type GetTenantRequest struct {
	ID uuid.UUID `json:"id"`
}

func ToGetRequest

func ToGetRequest(request *tenantv1.GetTenantRequest) *GetTenantRequest

type Port

type Port struct {
	DoListTenants  endpoint.Endpoint
	DoGetTenant    endpoint.Endpoint
	DoCreateTenant endpoint.Endpoint
	DoUpdateTenant endpoint.Endpoint
}

func NewPort

func NewPort(params PortParams) Port

func (Port) CreateTenant

func (t Port) CreateTenant(
	ctx context.Context,
	request *CreateTenantRequest,
) (*entity.Tenant, error)

func (Port) GetTenant

func (t Port) GetTenant(
	ctx context.Context,
	request *GetTenantRequest,
) (*entity.Tenant, error)

func (Port) ListTenants

func (t Port) ListTenants(
	ctx context.Context,
	request *domain.ListRequest,
) (*domain.ListResponse[entity.Tenant], error)

func (Port) UpdateTenant

func (t Port) UpdateTenant(
	ctx context.Context,
	request *UpdateTenantRequest,
) (*entity.Tenant, error)

type PortParams

type PortParams struct {
	fx.In
	Logger  *zap.Logger
	Service Service `name:"tenant_service"`
}

type Service

type Service interface {
	ListTenants(ctx context.Context, request *domain.ListRequest) (*domain.ListResponse[entity.Tenant], error)
	GetTenant(ctx context.Context, request *GetTenantRequest) (*entity.Tenant, error)
	CreateTenant(ctx context.Context, request *CreateTenantRequest) (*entity.Tenant, error)
	UpdateTenant(ctx context.Context, request *UpdateTenantRequest) (*entity.Tenant, error)
}

func NewService

func NewService(params ServiceParams) Service

type ServiceParams

type ServiceParams struct {
	fx.In
	Logger *zap.Logger
	Store  repository.TenantRepo `name:"tenant_store"`
}

type UpdateTenantRequest

type UpdateTenantRequest struct {
	ID                      uuid.UUID `json:"id"`
	Name                    string    `json:"name"`
	SubscriptionType        int       `json:"subscription_type"`
	SelfRegistrationEnabled bool      `json:"self_registration_enabled"`
}

func ToUpdateRequest

func ToUpdateRequest(request *tenantv1.UpdateTenantRequest) *UpdateTenantRequest

type Validator

type Validator interface {
	ValidateCreateTenant(ctx context.Context, request *CreateTenantRequest) error
	ValidateUpdateTenant(ctx context.Context, request *UpdateTenantRequest) error
}

func NewValidator

func NewValidator(params ValidatorParams) Validator

type ValidatorParams

type ValidatorParams struct {
	fx.In
	Repo repository.TenantRepo `name:"tenant_store"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL