Documentation ¶
Index ¶
- type AdminService
- type LoginResult
- type ORM
- func (orm *ORM) CompareAdminCodes(ctx context.Context, adminID string, code string) (bool, error)
- func (orm *ORM) CreateAdmin(ctx context.Context, name string, email string, password string, role string, ...) (*models.Admin, error)
- func (orm *ORM) DeleteAdmin(ctx context.Context, adminID string) (bool, error)
- func (orm *ORM) ForgotPasswordRequest(ctx context.Context, email string) (*models.Admin, error)
- func (orm *ORM) LoginAdmin(ctx context.Context, email string, password string) (*LoginResult, error)
- func (orm *ORM) ResendCode(ctx context.Context, adminID string) (*models.Admin, error)
- func (orm *ORM) ResetPassword(ctx context.Context, adminID string, password string) (bool, error)
- func (orm *ORM) UpdateAdmin(ctx context.Context, adminID string, fullname *string, email *string, ...) (bool, error)
- func (orm *ORM) UpdateAdminPassword(ctx context.Context, adminID string, oldPassword string, newPassword string) (bool, error)
- func (orm *ORM) UpdateAdminRole(ctx context.Context, adminID string, role string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminService ¶
type AdminService interface { CreateAdmin(ctx context.Context, name string, email string, password string, role string, createdBy *string, phone *string) (*models.Admin, error) LoginAdmin(ctx context.Context, email string, password string) (*LoginResult, error) UpdateAdminRole(ctx context.Context, adminID string, role string) (bool, error) UpdateAdmin(ctx context.Context, adminID string, fullname *string, email *string, phone *string) (bool, error) UpdateAdminPassword(ctx context.Context, adminID string, oldPassword string, newPassword string) (bool, error) DeleteAdmin(ctx context.Context, adminID string) (bool, error) ForgotPasswordRequest(ctx context.Context, email string) (*models.Admin, error) ResendCode(ctx context.Context, adminID string) (*models.Admin, error) CompareAdminCodes(ctx context.Context, adminID string, code string) (bool, error) ResetPassword(ctx context.Context, adminID string, password string) (bool, error) }
AdminService inteface holds the user-databse transactions of this controller
func NewAdminSvc ¶
func NewAdminSvc(db *orm.ORM, rdb *redis.Client) AdminService
NewAdminSvc exposed the ORM to the admin functions in the module
type LoginResult ¶
LoginResult is the typing for returning login successful data to user
type ORM ¶
ORM gets orm connection
func (*ORM) CompareAdminCodes ¶
CompareAdminCodes compares the admin code sent by user
func (*ORM) CreateAdmin ¶
func (orm *ORM) CreateAdmin(ctx context.Context, name string, email string, password string, role string, createdBy *string, phone *string) (*models.Admin, error)
CreateAdmin creates an admin when invoked
func (*ORM) DeleteAdmin ¶
DeleteAdmin deletes an admin
func (*ORM) ForgotPasswordRequest ¶
ForgotPasswordRequest is to start the process
func (*ORM) LoginAdmin ¶
func (orm *ORM) LoginAdmin(ctx context.Context, email string, password string) (*LoginResult, error)
LoginAdmin checks if the email is having valid credentials and returns them a unique, secured token to help them get resources from app
func (*ORM) ResendCode ¶
ResendCode helps to resend a new code
func (*ORM) ResetPassword ¶
ResetPassword updates the admins new password
func (*ORM) UpdateAdmin ¶
func (orm *ORM) UpdateAdmin(ctx context.Context, adminID string, fullname *string, email *string, phone *string) (bool, error)
UpdateAdmin updates data of an admin