business

package
v0.0.0-...-6dde671 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProtectedHandler

func ProtectedHandler(w http.ResponseWriter, r *http.Request)

ProtectedHandler is a protected handler.

func PublicHandler

func PublicHandler(w http.ResponseWriter, r *http.Request)

func RegisterBusinessHandlers

func RegisterBusinessHandlers(r *mux.Router, service Service, logger log.Logger, secret string)

func RegisterHandlers

func RegisterHandlers(r *mux.Router, service Service, logger log.Logger, secret string)

Types

type Business

type Business struct {
	entity.Business
}

Business represents the data about a BusinessCategory.

type CreateBusinessRequest

type CreateBusinessRequest struct {
	BusinessName    string `json:"businessName,omitempty" validate:"required"`
	Website         string `json:"website,omitempty" validate:"url"`
	OwnerFullName   string `json:"ownerFullName,omitempty" validate:"required"`
	OwnerJobTitle   string
	WorkEmail       string `json:"workEmail,omitempty" validate:"required,email"`
	PhoneNumber     string `json:"phoneNumber,omitempty" validate:"required"`
	Password        string `json:"password,omitempty" validate:"required,min=8"`
	ConfirmPassword string `json:"confirmPassword,omitempty" validate:"required,eqfield=Password"`
}

CreateBusinessCategoryRequest represents an category creation request.

func (CreateBusinessRequest) Validate

func (m CreateBusinessRequest) Validate() error

Validate validates the CreateAlbumRequest fields.

type Repository

type Repository interface {
	// Get returns the category with the specified album ID.
	Get(ctx context.Context, id primitive.ObjectID) (entity.Business, error)
	GetByEmail(ctx context.Context, email string) (entity.Business, error)
	Create(ctx context.Context, business entity.Business) (*primitive.ObjectID, error)
	StartSession() (mongo.Session, error)
}

Repository encapsulates the logic to access categories from the data source.

func NewRepository

func NewRepository(db *dbcontext.DB, logger log.Logger) Repository

type Service

type Service interface {
	Get(ctx context.Context, id primitive.ObjectID) (Business, error)
	Register(ctx context.Context, req CreateBusinessRequest) (Business, error)
	GetByName(ctx context.Context, name string) (Business, error)
}

Service encapsulates use case logic for businesses.

func NewService

func NewService(repo Repository, userRepo user.Repository, logger log.Logger) Service

NewService creates a new category service.

Jump to

Keyboard shortcuts

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