Documentation
¶
Index ¶
- func Authenticate(ctx context.Context, client *ent.Client, input *model.LoginIn) (*ent.User, bool)
- func AuthenticateByGoogle(ctx context.Context, client *ent.Client, input *model.LoginByGoogleIn) (*ent.User, error)
- func ChangePassword(ctx context.Context, client *ent.Client, id int, input *model.ChangePasswordIn) error
- func CheckPasswordHash(password, hash string) bool
- func CheckValidStatus(currentUser *ent.User) error
- func Count(ctx context.Context, client *ent.Client) (int, error)
- func Create(ctx context.Context, client *ent.Client, input *model.CreateUserIn) (*ent.User, error)
- func CreateInitUser(ctx context.Context, client *ent.Client, initUser *model.CreateUserIn) error
- func Delete(ctx context.Context, client *ent.Client, id int) error
- func ForgotPassword(ctx context.Context, client *ent.Client, userEmail *string) error
- func GetUserContext(client *ent.Client, email string) (*ent.User, error)
- func GetUserIDByEmail(client *ent.Client, email string) (int, error)
- func HasAnyPermission(user *ent.User, permissions []model.Permission) bool
- func HashPassword(password string) (string, error)
- func RegisterUser(ctx context.Context, client *ent.Client, input *model.RegisterUserIn) (*ent.User, error)
- func ResetPassword(ctx context.Context, client *ent.Client, input *model.ResetPasswordIn) error
- func Update(ctx context.Context, client *ent.Client, id int, input *model.UpdateUserIn) (*ent.User, error)
- func UpdateCurrentUser(ctx context.Context, client *ent.Client, id int, ...) (*ent.User, error)
- func Users(ctx context.Context, client *ent.Client, input *model.UsersIn) (*ent.UserConnection, error)
- type EmailExists
- type WrongEmailOrPasswordError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
Authenticate for login
func AuthenticateByGoogle ¶
func ChangePassword ¶
func ChangePassword(ctx context.Context, client *ent.Client, id int, input *model.ChangePasswordIn) error
ChangePassword of current User
func CheckPasswordHash ¶
CheckPasswordHash compares raw password with it's hashed values
func CheckValidStatus ¶
CheckValidStatus check if current user is in DEACTIVE status
func CreateInitUser ¶
CreateInitUser create un initial User for the application
func ForgotPassword ¶
ForgotPassword of the User
func GetUserContext ¶
GetUserContext of the current User
func GetUserIDByEmail ¶
GetUserIDByEmail check if a user exists in database by given email
func HasAnyPermission ¶
func HasAnyPermission(user *ent.User, permissions []model.Permission) bool
HasAnyPermission check if user has any expected permission
func HashPassword ¶
HashPassword hashes given password
func RegisterUser ¶
func RegisterUser(ctx context.Context, client *ent.Client, input *model.RegisterUserIn) (*ent.User, error)
RegisterUser new User
func ResetPassword ¶
ResetPassword of the User
func Update ¶
func Update(ctx context.Context, client *ent.Client, id int, input *model.UpdateUserIn) (*ent.User, error)
Update update an User
Types ¶
type EmailExists ¶
type EmailExists struct{}
EmailExists error in the case create a new user with an email that exists
func (*EmailExists) Error ¶
func (u *EmailExists) Error() string
type WrongEmailOrPasswordError ¶
type WrongEmailOrPasswordError struct{}
WrongEmailOrPasswordError error in the case log in with wrong email or password
func (*WrongEmailOrPasswordError) Error ¶
func (m *WrongEmailOrPasswordError) Error() string