feat(platform): add GET /api/health and GET /api/v1/user/self

This commit is contained in:
ryan
2026-08-30 11:32:03 +08:00
parent 9a5c2fa643
commit 4ce7110e23
5 changed files with 163 additions and 0 deletions
+16
View File
@@ -200,6 +200,22 @@ func ChangePassword(c *gin.Context) {
c.JSON(http.StatusOK, response.OKNil())
}
// Self returns the current authenticated user.
func Self(c *gin.Context) {
svc := getAuthService()
if svc == nil {
response.AbortUnauthorized(c, errUserNotFound)
return
}
user, err := svc.GetCurrentUser(c)
if err != nil {
logger.ErrorF(c.Request.Context(), "get current user failed: %v", err)
response.AbortUnauthorized(c, errUserNotFound)
return
}
c.JSON(http.StatusOK, response.OK(user))
}
// UpdateProfile updates profile info.
func UpdateProfile(c *gin.Context) {
var req updateProfileRequest