Skip to content

Commit f17b381

Browse files
committed
feat(user): simplify user response structure in JSON output
1 parent 8206084 commit f17b381

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

controller/user.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,17 @@ func setupLogin(user *model.User, c *gin.Context) {
110110
})
111111
return
112112
}
113-
cleanUser := model.User{
114-
Id: user.Id,
115-
Username: user.Username,
116-
DisplayName: user.DisplayName,
117-
Role: user.Role,
118-
Status: user.Status,
119-
Group: user.Group,
120-
}
121113
c.JSON(http.StatusOK, gin.H{
122114
"message": "",
123115
"success": true,
124-
"data": cleanUser,
116+
"data": map[string]any{
117+
"id": user.Id,
118+
"username": user.Username,
119+
"display_name": user.DisplayName,
120+
"role": user.Role,
121+
"status": user.Status,
122+
"group": user.Group,
123+
},
125124
})
126125
}
127126

0 commit comments

Comments
 (0)