user

package
v0.0.0-...-2b208be Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: GPL-3.0 Imports: 6 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 {
	FindByID(ctx *fiber.Ctx, id uint) (*User, error)
	BuildProfile(ctx *fiber.Ctx, user *User) (*User, error)
	CreateMinimal(ctx *fiber.Ctx, email, password, phoneNumber string) (*User, error)
	FindByEmailAndPassword(ctx *fiber.Ctx, email, password string) (*User, error)
	FindByEmail(ctx *fiber.Ctx, email string) (*User, error)
	DoesEmailExist(ctx *fiber.Ctx, email string) (bool, error)
	ChangePassword(ctx *fiber.Ctx, email, password string) error
}

func NewPostgresRepo

func NewPostgresRepo(db *gorm.DB) Repository

type Service

type Service interface {
	Register(ctx *fiber.Ctx, email, password, phoneNumber string) (*User, error)
	Login(ctx *fiber.Ctx, email, password string) (*User, error)
	ChangePassword(ctx *fiber.Ctx, email, password string) error
	BuildProfile(ctx *fiber.Ctx, user *User) (*User, error)
	GetUserProfile(ctx *fiber.Ctx, email string) (*User, error)
	IsValid(user *User) (bool, error)
	GetRepo() Repository
}

func NewService

func NewService(r Repository) Service

type User

type User struct {
	gorm.Model
	FirstName   string `json:"first_name,omitempty"`
	LastName    string `json:"last_name,omitempty"`
	Password    string `json:"password,omitempty"`
	PhoneNumber string `json:"phone_number,omitempty"`
	Email       string `json:"email,omitempty"`
	Address     string `json:"address,omitempty"`
	ProfilePic  string `json:"profile_pic,omitempty"`
}

Jump to

Keyboard shortcuts

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