Auto reg user, event map

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2025-12-25 21:30:26 +08:00
parent c7cefb3898
commit b30d9db69d
10 changed files with 116 additions and 41 deletions

View File

@@ -1,7 +1,6 @@
package user
import (
"net/http"
"nixcn-cms/data"
"github.com/gin-gonic/gin"
@@ -16,7 +15,7 @@ func Update(c *gin.Context) {
user := new(data.User)
userId, ok := c.Get("user_id")
if !ok {
c.JSON(http.StatusUnauthorized, gin.H{
c.JSON(403, gin.H{
"status": "can not found user id",
})
return
@@ -27,7 +26,7 @@ func Update(c *gin.Context) {
// Reject permission 0 user
if user.PermissionLevel == 0 {
c.JSON(http.StatusForbidden, gin.H{
c.JSON(403, gin.H{
"status": "premission denied",
})
return
@@ -41,7 +40,7 @@ func Update(c *gin.Context) {
// Update user info
user.UpdateByUserID(userId.(uuid.UUID), &ReqInfo)
c.JSON(http.StatusOK, gin.H{
c.JSON(200, gin.H{
"status": "success",
})
}