model

package
v0.0.0-...-fc131ae Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionUser = "users"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Name string `json:"name"`
}

type InfoService

type InfoService interface {
	GetInfoByID(c context.Context, userID string) (*Info, error)
}

type JwtCustomClaims

type JwtCustomClaims struct {
	Name string `json:"name"`
	ID   string `json:"id"`
	jwt.StandardClaims
}

type JwtCustomRefreshClaims

type JwtCustomRefreshClaims struct {
	ID string `json:"id"`
	jwt.StandardClaims
}

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email" binding:"required,email"`
	Password string `json:"password" binding:"required"`
}

type LoginService

type LoginService interface {
	GetUserByEmail(c context.Context, email string) (User, error)
	GenAccessToken(user *User, secret string, expiry int) (accessToken string, err error)
	GenRefreshToken(user *User, secret string, expiry int) (refreshToken string, err error)
}

type RegisterRequest

type RegisterRequest struct {
	Name            string `json:"name" binding:"required,min=2,max=30"`
	Email           string `json:"email" binding:"required,email"`
	Password        string `json:"password" binding:"required,min=6"`
	ConfirmPassword string `json:"confirm_password" binding:"required,min=6"`
}

type RegisterService

type RegisterService interface {
	Save(c context.Context, payload *RegisterRequest) error
	GetUserByEmail(c context.Context, email string) (User, error)
}

type User

type User struct {
	ID       primitive.ObjectID `bson:"_id"`
	Name     string             `bson:"name"`
	Email    string             `bson:"email"`
	Password string             `bson:"password"`
}

type UserRepository

type UserRepository interface {
	Save(c context.Context, user *User) error
	GetByID(c context.Context, id string) (User, error)
	GetByEmail(c context.Context, email string) (User, error)
}

Jump to

Keyboard shortcuts

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