user

package
v0.0.0-...-4bd84e9 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(s IService, store *session.Store) *Controller

func (*Controller) Create

func (uc *Controller) Create(c *fiber.Ctx) error

func (*Controller) Login

func (uc *Controller) Login(c *fiber.Ctx) error

type IRepository

type IRepository interface {
	Upsert(user *RequestUser) error
	GetOne(uname string) (*User, error)
	GetReqUser(uname string) (*RequestUser, error)
	ValidateUsername(uname string) error
	ValidatePassword(password string) error
}

type IService

type IService interface {
	Create(user *RequestUser) (*User, error)
	Login(user *RequestUser) (*User, error)
}

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(ctx context.Context, client *mongo.Client) *Repository

func (*Repository) GetOne

func (r *Repository) GetOne(uname string) (*User, error)

func (*Repository) GetReqUser

func (r *Repository) GetReqUser(uname string) (*RequestUser, error)

func (*Repository) Upsert

func (r *Repository) Upsert(user *RequestUser) error

func (*Repository) ValidatePassword

func (r *Repository) ValidatePassword(password string) error

func (*Repository) ValidateUsername

func (r *Repository) ValidateUsername(uname string) error

type RequestUser

type RequestUser struct {
	Username  string `json:"username" bson:"username"`
	Email     string `json:"email" bson:"email"`
	Password  string `json:"password" bson:"password"`
	FirstName string `json:"firstname" bson:"firstname"`
	LastName  string `json:"lastname" bson:"lastname"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(r IRepository) *Service

func (*Service) Create

func (s *Service) Create(user *RequestUser) (*User, error)

func (*Service) Login

func (s *Service) Login(user *RequestUser) (*User, error)

type User

type User struct {
	ID        primitive.ObjectID
	Username  string `json:"username" bson:"username"`
	Email     string `json:"email" bson:"email"`
	FirstName string `json:"firstname" bson:"firstname"`
	LastName  string `json:"lastname" bson:"lastname"`
}

Jump to

Keyboard shortcuts

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