service

package
v0.0.0-...-01627f8 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONResponse

func JSONResponse(c *gin.Context, statusCode int, data interface{}, headers map[string]string, message string)

JSONResponse builds and sends a JSON response

Types

type Response

type Response struct {
	StatusCode int         `json:"status"`
	Data       interface{} `json:"data,omitempty"`
	Message    string      `json:"message,omitempty"`
}

Response represents the standard response format

type User

type User struct {
	// contains filtered or unexported fields
}

User represents the requirements of the service

func New

func New(config *config.AppConfig, db db.Service) *User

New returns a User Service instance

func (*User) GetAuthUsersMe

func (u *User) GetAuthUsersMe(c *gin.Context)

GetAuthUsersMe Get the authenticated user's profile (GET /auth/users/me)

func (*User) PostAuthChangePassword

func (u *User) PostAuthChangePassword(c *gin.Context)

PostAuthChangePassword Change user's password (POST /auth/change-password)

func (*User) PostAuthLogin

func (u *User) PostAuthLogin(c *gin.Context)

PostAuthLogin Authenticate user and get an access token (POST /auth/login)

func (*User) PostAuthLogout

func (u *User) PostAuthLogout(c *gin.Context)

PostAuthLogout Logout the user and invalidate tokens (POST /auth/logout)

func (*User) PostAuthRefresh

func (u *User) PostAuthRefresh(c *gin.Context)

PostAuthRefresh Refresh access token using refresh token (POST /auth/refresh)

func (*User) PostAuthRegister

func (u *User) PostAuthRegister(c *gin.Context)

PostAuthRegister Register a new user (POST /auth/register)

Jump to

Keyboard shortcuts

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