package handler import ( "net/http" "gongzheng_minimax/service" "github.com/gin-gonic/gin" ) // TokenHandler handles token generation requests type TokenHandler struct { tokenService *service.TokenService } // NewTokenHandler creates a new instance of TokenHandler func NewTokenHandler(tokenService *service.TokenService) *TokenHandler { return &TokenHandler{ tokenService: tokenService, } } // GenerateToken handles token generation requests func (h *TokenHandler) GenerateToken(c *gin.Context) { token, err := h.tokenService.CreateSignature() if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } c.JSON(http.StatusOK, gin.H{ "token": token, }) }