controller

package
v0.0.0-...-80fbdfb Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BearerAuth

func BearerAuth(r *http.Request) (string, bool)

func NewOauth2

func NewOauth2(db *gorm.DB, ts *oredis.TokenStore, clientStore oauth2.ClientStore) *server.Server

func NewUserId

func NewUserId() uuid.UUID

func PasswordAuthorizationHandler

func PasswordAuthorizationHandler(db *gorm.DB) func(context.Context, string, string, string) (string, error)

Types

type API

type API struct {
	DB          *gorm.DB
	Log         *logrus.Logger
	Grpc        userpb.UserServiceClient
	OauthConfig oauth2.Config
	TS          *oredis.TokenStore
	SRV         *server.Server
}

func NewApp

func NewApp(db *gorm.DB, log *logrus.Logger, grpc userpb.UserServiceClient, oConfig oauth2.Config, ts *oredis.TokenStore, srv *server.Server) *API

func (API) CreateUser

func (a API) CreateUser(c *gin.Context)

func (API) CurrentUser

func (a API) CurrentUser(c *gin.Context)

func (API) DeleteUser

func (a API) DeleteUser(c *gin.Context)

func (API) ForgetPass

func (a API) ForgetPass(c *gin.Context)

func (API) GetUser

func (a API) GetUser(c *gin.Context)

func (API) GetUsers

func (a API) GetUsers(c *gin.Context)

func (API) Login

func (a API) Login() gin.HandlerFunc

func (API) Logout

func (a API) Logout() gin.HandlerFunc

func (API) OnlyAdmin

func (a API) OnlyAdmin() gin.HandlerFunc

func (API) ResetPass

func (a API) ResetPass(c *gin.Context)

func (API) UpdateUser

func (a API) UpdateUser(c *gin.Context)

func (API) ValidateToken

func (a API) ValidateToken() gin.HandlerFunc

type User

type User struct {
	Id       string `json:"id"`
	Name     string `json:"name"`
	Phone    string `json:"phone"`
	Role     string `json:"role"`
	Password string `json:"password,omitempty"`
}

Jump to

Keyboard shortcuts

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