entity

package
v0.0.0-...-d68acc2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

type AuthService interface {
	Login(userInput *User) (string, error)
}

AuthService interface

type Base

type Base struct {
	ID        uuid.UUID  `gorm:"type:uuid;primary_key;" json:"id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `gorm:"index" json:"deleted_at"`
}

Base model

type CreateTokenDTO

type CreateTokenDTO struct {
	UserID    uuid.UUID `json:"user_id,omitempty"`
	Token     string    `json:"token,omitempty"`
	ExpiredAt int       `json:"expired_at,omitempty"`
}

CreateTokenDTO model

type JWTService

type JWTService interface {
	Create(*User) (*Token, error)
	GetUser(string) (*User, error)
}

JWTService interface

type Token

type Token struct {
	Base
	UserID    uuid.UUID  `json:"user_id,omitempty"`
	Token     string     `json:"token,omitempty"`
	ExpiredAt *time.Time `json:"expired_at,omitempty"`
}

Token model

func (*Token) BeforeCreate

func (u *Token) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate func

type TokenRepository

type TokenRepository interface {
	Create(*Token) (*Token, error)
	FindByUserID(uuid.UUID) (*Token, error)
	FindByToken(string) (*Token, error)
}

TokenRepository interface

type TokenService

type TokenService interface {
	Create(*Token) (*Token, error)
	FindByUserID(uuid.UUID) (*Token, error)
	FindByToken(string) (*Token, error)
}

TokenService interface

type User

type User struct {
	Base
	Email    string `json:"email"`
	Password string `json:"-"`
}

User model

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate func

func (User) IsPasswordValid

func (u User) IsPasswordValid(password string) error

IsPasswordValid func

type UserChangePasswordDTO

type UserChangePasswordDTO struct {
	Password string `json:"password"`
}

UserChangePasswordDTO struct

type UserLoginDTO

type UserLoginDTO struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

UserLoginDTO struct

type UserRepository

type UserRepository interface {
	All() ([]*User, error)
	Create(user *User) (*User, error)
	FindByID(id uuid.UUID) (*User, error)
	FindByEmail(email string) (*User, error)
	ChangePassword(id uuid.UUID, password string) (*User, error)
}

UserRepository interface

type UserService

type UserService interface {
	All() ([]*User, error)
	Create(user *User) (*User, error)
	FindByID(id uuid.UUID) (*User, error)
	FindByEmail(email string) (*User, error)
	ChangePassword(id uuid.UUID, password string) (*User, error)
}

UserService interface

Jump to

Keyboard shortcuts

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