controller

package
v0.0.0-...-53e80a7 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserController

type UserController interface {
	Create(ctx context.Context, requestData *UserCreateRequestIDO) (*user_s.User, error)
	GetByID(ctx context.Context, id primitive.ObjectID) (*user_s.User, error)
	GetUserBySessionUUID(ctx context.Context, sessionUUID string) (*domain.User, error)
	ArchiveByID(ctx context.Context, id primitive.ObjectID) (*user_s.User, error)
	DeleteByID(ctx context.Context, id primitive.ObjectID) error
	ListByFilter(ctx context.Context, f *user_s.UserListFilter) (*user_s.UserListResult, error)
	ListAsSelectOptionByFilter(ctx context.Context, f *user_s.UserListFilter) ([]*user_s.UserAsSelectOption, error)
	UpdateByID(ctx context.Context, request *UserUpdateRequestIDO) (*user_s.User, error)
	CreateComment(ctx context.Context, customerID primitive.ObjectID, content string) (*user_s.User, error)
}

UserController Interface for user business logic controller.

func NewController

func NewController(
	appCfg *config.Conf,
	loggerp *slog.Logger,
	uuidp uuid.Provider,
	passwordp password.Provider,
	kmux kmutex.Provider,
	client *mongo.Client,
	org_storer tenant_s.TenantStorer,
	usr_storer user_s.UserStorer,
	temailer templatedemailer.TemplatedEmailer,
) UserController

type UserControllerImpl

type UserControllerImpl struct {
	Config           *config.Conf
	Logger           *slog.Logger
	UUID             uuid.Provider
	Password         password.Provider
	Kmutex           kmutex.Provider
	DbClient         *mongo.Client
	TenantStorer     tenant_s.TenantStorer
	UserStorer       user_s.UserStorer
	TemplatedEmailer templatedemailer.TemplatedEmailer
}

func (*UserControllerImpl) ArchiveByID

func (impl *UserControllerImpl) ArchiveByID(ctx context.Context, id primitive.ObjectID) (*user_s.User, error)

func (*UserControllerImpl) Create

func (impl *UserControllerImpl) Create(ctx context.Context, requestData *UserCreateRequestIDO) (*user_s.User, error)

func (*UserControllerImpl) CreateComment

func (c *UserControllerImpl) CreateComment(ctx context.Context, customerID primitive.ObjectID, content string) (*user_s.User, error)

func (*UserControllerImpl) DeleteByID

func (impl *UserControllerImpl) DeleteByID(ctx context.Context, id primitive.ObjectID) error

func (*UserControllerImpl) GetByID

func (*UserControllerImpl) GetUserBySessionUUID

func (c *UserControllerImpl) GetUserBySessionUUID(ctx context.Context, sessionUUID string) (*domain.User, error)

CreateInitialRootAdmin function creates the initial root administrator if not previously created.

func (*UserControllerImpl) ListAsSelectOptionByFilter

func (c *UserControllerImpl) ListAsSelectOptionByFilter(ctx context.Context, f *user_s.UserListFilter) ([]*user_s.UserAsSelectOption, error)

func (*UserControllerImpl) ListByFilter

func (*UserControllerImpl) UpdateByID

func (impl *UserControllerImpl) UpdateByID(ctx context.Context, requestData *UserUpdateRequestIDO) (*user_s.User, error)

type UserCreateRequestIDO

type UserCreateRequestIDO struct {
	TenantID     primitive.ObjectID `bson:"tenant_id" json:"tenant_id,omitempty"`
	FirstName    string             `json:"first_name"`
	LastName     string             `json:"last_name"`
	Email        string             `json:"email"`
	Phone        string             `json:"phone,omitempty"`
	Country      string             `json:"country,omitempty"`
	Region       string             `json:"region,omitempty"`
	City         string             `json:"city,omitempty"`
	PostalCode   string             `json:"postal_code,omitempty"`
	AddressLine1 string             `json:"address_line1,omitempty"`
	AddressLine2 string             `json:"address_line2,omitempty"`
	// HowDidYouHearAboutUs      int8               `json:"how_did_you_hear_about_us,omitempty"`
	// HowDidYouHearAboutUsOther string             `json:"how_did_you_hear_about_us_other,omitempty"`
	AgreeTOS             bool   `json:"agree_tos,omitempty"`
	AgreePromotionsEmail bool   `json:"agree_promotions_email,omitempty"`
	Status               int8   `bson:"status" json:"status"`
	Role                 int8   `bson:"role" json:"role"`
	HasShippingAddress   bool   `bson:"has_shipping_address" json:"has_shipping_address,omitempty"`
	ShippingName         string `bson:"shipping_name" json:"shipping_name,omitempty"`
	ShippingPhone        string `bson:"shipping_phone" json:"shipping_phone,omitempty"`
	ShippingCountry      string `bson:"shipping_country" json:"shipping_country,omitempty"`
	ShippingRegion       string `bson:"shipping_region" json:"shipping_region,omitempty"`
	ShippingCity         string `bson:"shipping_city" json:"shipping_city,omitempty"`
	ShippingPostalCode   string `bson:"shipping_postal_code" json:"shipping_postal_code,omitempty"`
	ShippingAddressLine1 string `bson:"shipping_address_line1" json:"shipping_address_line1,omitempty"`
	ShippingAddressLine2 string `bson:"shipping_address_line2" json:"shipping_address_line2,omitempty"`
}

type UserUpdateRequestIDO

type UserUpdateRequestIDO struct {
	ID                   primitive.ObjectID `bson:"_id" json:"id"`
	TenantID             primitive.ObjectID `bson:"tenant_id" json:"tenant_id,omitempty"`
	FirstName            string             `json:"first_name"`
	LastName             string             `json:"last_name"`
	Email                string             `json:"email"`
	Phone                string             `json:"phone,omitempty"`
	Country              string             `json:"country,omitempty"`
	Region               string             `json:"region,omitempty"`
	City                 string             `json:"city,omitempty"`
	Password             string             `json:"password"`
	PasswordRepeated     string             `json:"password_repeated"`
	AgreeTOS             bool               `json:"agree_tos,omitempty"`
	AgreePromotionsEmail bool               `json:"agree_promotions_email,omitempty"`
	Status               int8               `bson:"status" json:"status"`
	Role                 int8               `bson:"role" json:"role"`
}

Jump to

Keyboard shortcuts

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