mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-04 15:06:37 +08:00
refactor(util): move response helper to common/response and session logic to oauth
- Relocated generic HTTP response helpers (Response, OK, Err, etc.) from internal/util/ to a dedicated internal/common/response/ package. - Renamed ResponseAny to Any to resolve revive stuttering warnings. - Moved session building options and cookie headers logic from internal/util/ to internal/apps/oauth/. - Removed all direct imports of Gin/Sessions/HTTP frameworks from internal/util/ to keep general utilities 100% pure. - Regenerated Swagger API documentation via make swagger. - All tests and make code-check compile and pass with 0 issues.
This commit is contained in:
@@ -4,20 +4,19 @@
|
||||
// Package custom provides custom business handlers
|
||||
package custom
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
import ("net/http"
|
||||
|
||||
"github.com/Rain-kl/Wavelet/internal/util"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
"github.com/Rain-kl/Wavelet/internal/common/response")
|
||||
|
||||
// Hello is a sample handler for custom business logic
|
||||
// @Summary Sample Hello API
|
||||
// @Description A sample business API for customization
|
||||
// @Tags custom
|
||||
// @Produce json
|
||||
// @Success 200 {object} util.ResponseAny{data=string} "成功"
|
||||
// @Success 200 {object} response.Any{data=string} "成功"
|
||||
// @Router /api/v1/custom/hello [get]
|
||||
func Hello(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, util.OK("Hello from custom business module!"))
|
||||
c.JSON(http.StatusOK, response.OK("Hello from custom business module!"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user