user

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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

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

Types

type CreateUserRequest

type CreateUserRequest struct {
	Name     string   `json:"name"`
	Email    string   `json:"email"`
	Password string   `json:"password"`
	Roles    []string `json:"roles"`
}

func (CreateUserRequest) Validate

func (m CreateUserRequest) Validate() error

Validate validates the CreateAlbumRequest fields.

type Repository

type Repository interface {
	Get(ctx context.Context, id primitive.ObjectID) (entity.User, error)
	GetByEmail(ctx context.Context, id string) (entity.User, error)
	Create(ctx context.Context, user entity.User) (*primitive.ObjectID, error)
	//GetByEmailAndPassword(ctx context.Context, email string, hashedPassword []byte) (entity.User, 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) (*User, error)
	GetByEmail(ctx context.Context, email string) (User, error)
	Create(ctx context.Context, req CreateUserRequest) (*User, error)
}

Service encapsulates use case logic for businessCategories.

func NewService

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

NewService creates a new category service.

type User

type User struct {
	entity.User
}

User represents the data about a User.

Jump to

Keyboard shortcuts

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