feat: add USER_ID_MIDDLEWARE constant and update AuthMiddleware to use it

This commit is contained in:
Tran Anh Tuan
2026-05-13 15:52:26 +07:00
parent 61542af11b
commit b815111b8f
3 changed files with 9 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import (
"net/http"
"strings"
"wm-backend/configs/constants"
"wm-backend/pkg/helper"
"wm-backend/response"
@@ -48,7 +49,7 @@ func AuthMiddleware() gin.HandlerFunc {
}
// 5. Set user_id in gin context for downstream handlers
c.Set("user_id", userID)
c.Set(constants.USER_ID_MIDDLEWARE, userID)
c.Next()
}
}