user

package
v0.0.0-...-31bdb52 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	Create(user *User) (*User, error)
	GetByID(id uint) (*User, error)
	GetByEmail(email string) (*User, error)
	GetAll() ([]*User, error)
	Update(user *User) (*User, error)
	Delete(user *User) error
}

Repository represents the user permanent repo

type Usecase

type Usecase interface {
	Repository
	Login(email, password string) (*User, error)
	ChangePassword(id uint, oldPassword, newPassword string) (*User, error)
}

Usecase represents users usecases Extends User entity interface

func NewUsecase

func NewUsecase(repo Repository, passSvc pass.Service) Usecase

NewUsecase creates a new usecase. Implements the Usecase interface

type User

type User struct {
	ID       uint   `gorm:"primaryKey"`
	Surname  string `gorm:"size:60" validate:"required,gte=2,lte=60"`
	Name     string `gorm:"size:60" validate:"lte=60"`
	Email    string `gorm:"size=60,unique" validate:"email,required"`
	Password string `gorm:"-"`
	Hash     string `gorm:"size=60"`
	IsActive bool
}

User describes a user in the system

Jump to

Keyboard shortcuts

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