second commit

This commit is contained in:
Rogee
2026-06-04 15:44:48 +08:00
parent 4db6efb3a7
commit 8ac150bc7b
1275 changed files with 286124 additions and 0 deletions
@@ -0,0 +1,25 @@
package v1
import (
"strconv"
"github.com/gin-gonic/gin"
)
// handlerTestResponse is a shared response struct for unmarshalling handler test JSON output.
type handlerTestResponse struct {
Success bool `json:"success"`
Data interface{} `json:"data"`
}
// mockAuthMiddleware simulates auth middleware for edge-case tests.
// Sets user_id=1 and extracts account_id from URL param.
func mockAuthMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
c.Set("user_id", uint(1))
if accID, err := strconv.ParseUint(c.Param("account_id"), 10, 32); err == nil {
c.Set("account_id", uint(accID))
}
c.Next()
}
}