Documentation ¶
Index ¶
- type EmailRepository
- type ItemVendor
- type OTPRepository
- type Role
- type TokenRepository
- type User
- type UserController
- func (uc *UserController) AddAddress(c *gin.Context)
- func (uc *UserController) GetAddress(c *gin.Context)
- func (uc *UserController) GetAddresses(c *gin.Context)
- func (uc *UserController) GetUsers(c *gin.Context)
- func (uc *UserController) Login(c *gin.Context)
- func (uc *UserController) Logout(c *gin.Context)
- func (uc *UserController) Profile(c *gin.Context)
- func (uc *UserController) RefreshToken(c *gin.Context)
- func (uc *UserController) RemoveAddress(c *gin.Context)
- func (uc *UserController) ResendEmailVerificationOTP(c *gin.Context)
- func (uc *UserController) ResetPassword(c *gin.Context)
- func (uc *UserController) SendForgotPasswordOTP(c *gin.Context)
- func (uc *UserController) SignUp(c *gin.Context)
- func (uc *UserController) UpdateAddress(c *gin.Context)
- func (uc *UserController) VerifyUser(c *gin.Context)
- type UserRepo
- func (ur *UserRepo) CreateUser(user *User) error
- func (ur *UserRepo) GetUser(filter interface{}) (*User, error)
- func (ur *UserRepo) GetUsers(filter interface{}) ([]*User, error)
- func (ur *UserRepo) IsExists(email string) (bool, error)
- func (ur *UserRepo) UpdateUser(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error
- type UserRepository
- type UserService
- func (us *UserService) AddAddress(userid primitive.ObjectID, address types.Address) *errors.AppError
- func (us *UserService) GetAddress(userid, addressid primitive.ObjectID) (*types.Address, *errors.AppError)
- func (us *UserService) GetAddresses(userid primitive.ObjectID) ([]types.Address, *errors.AppError)
- func (us *UserService) GetUsers() ([]*User, *errors.AppError)
- func (us *UserService) Login(email, password string) (*User, *utils.TokenDetails, *errors.AppError)
- func (us *UserService) Logout(accessUuid string) *errors.AppError
- func (us *UserService) Profile(userId primitive.ObjectID) (*User, *errors.AppError)
- func (us *UserService) RefreshToken(refreshToken string) (*utils.TokenDetails, *errors.AppError)
- func (us *UserService) RemoveAddress(userid, addressid primitive.ObjectID) *errors.AppError
- func (us *UserService) ResendEmailVerificationOTP(email string) *errors.AppError
- func (us *UserService) ResetPassword(email, otp, password string) *errors.AppError
- func (us *UserService) SendForgotPasswordOTP(email string) *errors.AppError
- func (us *UserService) SignUpAndSendVerificationEmail(user *User) *errors.AppError
- func (us *UserService) UpdateAddress(userid, addressid primitive.ObjectID, address types.Address) *errors.AppError
- func (us *UserService) VerifyUser(email, otp string) *errors.AppError
- type UserServices
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmailRepository ¶
type ItemVendor ¶
type OTPRepository ¶
type TokenRepository ¶
type User ¶
type User struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` FirstName string `json:"first_name" bson:"first_name"` LastName string `json:"last_name" bson:"last_name"` Email string `json:"email" bson:"email"` Password string `json:"-" bson:"password"` PhoneNumber string `json:"phone_number" bson:"phone_number"` IsVerified bool `json:"is_verified" bson:"is_verified"` Addresses []types.Address `json:"addresses" bson:"addresses"` Role Role `json:"role" bson:"role"` CreatedAt time.Time `json:"created_at" bson:"created_at"` UpdatedAt time.Time `json:"updated_at" bson:"updated_at"` }
type UserController ¶
type UserController struct {
// contains filtered or unexported fields
}
func NewUserController ¶
func NewUserController(userServices UserServices) *UserController
func (*UserController) AddAddress ¶
func (uc *UserController) AddAddress(c *gin.Context)
func (*UserController) GetAddress ¶
func (uc *UserController) GetAddress(c *gin.Context)
func (*UserController) GetAddresses ¶
func (uc *UserController) GetAddresses(c *gin.Context)
func (*UserController) GetUsers ¶
func (uc *UserController) GetUsers(c *gin.Context)
func (*UserController) Login ¶
func (uc *UserController) Login(c *gin.Context)
func (*UserController) Logout ¶
func (uc *UserController) Logout(c *gin.Context)
func (*UserController) Profile ¶
func (uc *UserController) Profile(c *gin.Context)
func (*UserController) RefreshToken ¶
func (uc *UserController) RefreshToken(c *gin.Context)
func (*UserController) RemoveAddress ¶
func (uc *UserController) RemoveAddress(c *gin.Context)
func (*UserController) ResendEmailVerificationOTP ¶
func (uc *UserController) ResendEmailVerificationOTP(c *gin.Context)
func (*UserController) ResetPassword ¶
func (uc *UserController) ResetPassword(c *gin.Context)
TODO:: verify the otp before redirecting user to where they can reset their password
func (*UserController) SendForgotPasswordOTP ¶
func (uc *UserController) SendForgotPasswordOTP(c *gin.Context)
func (*UserController) SignUp ¶
func (uc *UserController) SignUp(c *gin.Context)
func (*UserController) UpdateAddress ¶
func (uc *UserController) UpdateAddress(c *gin.Context)
func (*UserController) VerifyUser ¶
func (uc *UserController) VerifyUser(c *gin.Context)
type UserRepo ¶
type UserRepo struct {
Collection *mongo.Collection
}
func NewUserRepo ¶
func NewUserRepo(collection *mongo.Collection) *UserRepo
func (*UserRepo) CreateUser ¶
func (*UserRepo) UpdateUser ¶
func (ur *UserRepo) UpdateUser(filter interface{}, update interface{}, opts ...*options.UpdateOptions) error
type UserRepository ¶
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(userRepository UserRepository, otpRepository OTPRepository, emailRepository EmailRepository, tokenRepository TokenRepository) *UserService
func (*UserService) AddAddress ¶
func (*UserService) GetAddress ¶
func (*UserService) GetAddresses ¶
func (*UserService) Login ¶
func (us *UserService) Login(email, password string) (*User, *utils.TokenDetails, *errors.AppError)
func (*UserService) RefreshToken ¶
func (us *UserService) RefreshToken(refreshToken string) (*utils.TokenDetails, *errors.AppError)
func (*UserService) RemoveAddress ¶
func (us *UserService) RemoveAddress(userid, addressid primitive.ObjectID) *errors.AppError
func (*UserService) ResendEmailVerificationOTP ¶
func (us *UserService) ResendEmailVerificationOTP(email string) *errors.AppError
func (*UserService) ResetPassword ¶
func (us *UserService) ResetPassword(email, otp, password string) *errors.AppError
func (*UserService) SendForgotPasswordOTP ¶
func (us *UserService) SendForgotPasswordOTP(email string) *errors.AppError
func (*UserService) SignUpAndSendVerificationEmail ¶
func (us *UserService) SignUpAndSendVerificationEmail(user *User) *errors.AppError
func (*UserService) UpdateAddress ¶
func (*UserService) VerifyUser ¶
func (us *UserService) VerifyUser(email, otp string) *errors.AppError
type UserServices ¶
type UserServices interface { SignUpAndSendVerificationEmail(user *User) *errors.AppError VerifyUser(email, otp string) *errors.AppError Login(email, password string) (*User, *utils.TokenDetails, *errors.AppError) Profile(userId primitive.ObjectID) (*User, *errors.AppError) Logout(accessUuid string) *errors.AppError SendForgotPasswordOTP(email string) *errors.AppError ResetPassword(email, otp, password string) *errors.AppError RefreshToken(refreshToken string) (*utils.TokenDetails, *errors.AppError) ResendEmailVerificationOTP(email string) *errors.AppError AddAddress(userid primitive.ObjectID, address types.Address) *errors.AppError RemoveAddress(userid, addressid primitive.ObjectID) *errors.AppError GetAddresses(userid primitive.ObjectID) ([]types.Address, *errors.AppError) GetAddress(userid, addressid primitive.ObjectID) (*types.Address, *errors.AppError) UpdateAddress(userid, addressid primitive.ObjectID, address types.Address) *errors.AppError GetUsers() ([]*User, *errors.AppError) }
Click to show internal directories.
Click to hide internal directories.