Documentation
¶
Index ¶
- func ProtectedHandler(w http.ResponseWriter, r *http.Request)
- func PublicHandler(w http.ResponseWriter, r *http.Request)
- func RegisterBusinessHandlers(r *mux.Router, service Service, logger log.Logger, secret string)
- func RegisterHandlers(r *mux.Router, service Service, logger log.Logger, secret string)
- type Business
- type CreateBusinessRequest
- type Repository
- type Service
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)
Types ¶
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.
Click to show internal directories.
Click to hide internal directories.