organization

package
v0.1.1-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(r *echo.Group, service Service)

Types

type Organization

type Organization struct {
	mongo_entity.Organization
}

type OrganizationCreationRequest

type OrganizationCreationRequest struct {
	Identifier  string                  `json:"identifier" bson:"identifier"`
	DisplayName string                  `json:"display_name" bson:"display_name"`
	API_KEY     string                  `json:"api_key" bson:"api_key"`
	Resources   []mongo_entity.Resource `json:"resources,omitempty" bson:"resources"`
	Users       []mongo_entity.User     `json:"users,omitempty" bson:"users"`
	Roles       []mongo_entity.Role     `json:"roles,omitempty" bson:"roles"`
	Groups      []mongo_entity.Group    `json:"groups,omitempty" bson:"groups"`
	Polices     []mongo_entity.Policy   `json:"policies,omitempty" bson:"policies"`
}

func (OrganizationCreationRequest) Validate

func (m OrganizationCreationRequest) Validate() error

type Repository

type Repository interface {
	Get(ctx context.Context, id string) (*mongo_entity.Organization, error)
	GetIdByIdentifier(ctx context.Context, identifier string) (string, error)
	Query(ctx context.Context) ([]mongo_entity.Organization, error)
	Create(ctx context.Context, organization mongo_entity.Organization) (string, error)
	Delete(ctx context.Context, id string) error
	RefreshAPIKey(ctx context.Context, apiKey string, id string) error
	CheckOrgExistById(ctx context.Context, id string) (bool, error)
	CheckOrgExistByIdentifier(ctx context.Context, identifier string) (bool, error)
}

func NewRepository

func NewRepository(mongodb *db.MongoDB) Repository

type Service

type Service interface {
	Get(ctx context.Context, id string) (Organization, error)
	GetIdByIdentifier(ctx context.Context, identifier string) (string, error)
	Query(ctx context.Context) ([]Organization, error)
	Create(ctx context.Context, req OrganizationCreationRequest) (Organization, error)
	RegenerateAPIKey(ctx context.Context, id string) (Organization, error)
	Delete(ctx context.Context, id string) (Organization, error)
	CheckOrgExistByIdentifier(ctx context.Context, identifier string) (bool, error)
}

func NewService

func NewService(repo Repository, logger *zap.Logger) Service

Jump to

Keyboard shortcuts

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