@@ -13,16 +13,22 @@ func Update(c *gin.Context) {
|
||||
|
||||
// New user model
|
||||
user := new(data.User)
|
||||
userId, ok := c.Get("user_id")
|
||||
userIdOrig, ok := c.Get("user_id")
|
||||
if !ok {
|
||||
c.JSON(403, gin.H{
|
||||
"status": "can not found user id",
|
||||
})
|
||||
return
|
||||
}
|
||||
userId, err := uuid.Parse(userIdOrig.(string))
|
||||
if err != nil {
|
||||
c.JSON(500, gin.H{
|
||||
"status": "failed to parse uuid",
|
||||
})
|
||||
}
|
||||
|
||||
// Get user info
|
||||
user.GetByUserId(userId.(uuid.UUID))
|
||||
user.GetByUserId(userId)
|
||||
|
||||
// Reject permission 0 user
|
||||
if user.PermissionLevel == 0 {
|
||||
@@ -38,7 +44,7 @@ func Update(c *gin.Context) {
|
||||
user.Subtitle = ReqInfo.Subtitle
|
||||
|
||||
// Update user info
|
||||
user.UpdateByUserID(userId.(uuid.UUID))
|
||||
user.UpdateByUserID(userId)
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"status": "success",
|
||||
|
||||
Reference in New Issue
Block a user