moved db indices to uint
This commit is contained in:
@@ -49,8 +49,9 @@ func (uc *UserController) UpdateHandler(c *gin.Context) {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "JWT parsing error"})
|
||||
return
|
||||
}
|
||||
jwtUserID := int64((*claims)["user_id"].(float64))
|
||||
jwtUserID := uint((*claims)["user_id"].(float64))
|
||||
userRole := int8((*claims)["role_id"].(float64))
|
||||
|
||||
if user.ID == 0 {
|
||||
logger.Error.Printf("No User.ID in request from user with id: %v, aborting", jwtUserID)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "No user id provided"})
|
||||
@@ -94,15 +95,15 @@ func (uc *UserController) CurrentUserHandler(c *gin.Context) {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Missing or invalid user ID type"})
|
||||
return
|
||||
}
|
||||
userID, ok := userIDInterface.(int64)
|
||||
userID, ok := userIDInterface.(uint)
|
||||
|
||||
if !ok {
|
||||
logger.Error.Printf("Error: user_id is not of type int64")
|
||||
logger.Error.Printf("Error: user_id is not of type uint")
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Invalid user ID type"})
|
||||
return
|
||||
}
|
||||
|
||||
user, err := uc.Service.GetUserByID(int64(userID))
|
||||
user, err := uc.Service.GetUserByID(uint(userID))
|
||||
if err != nil {
|
||||
logger.Error.Printf("Error retrieving valid user: %v", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Error retrieving user."})
|
||||
|
||||
Reference in New Issue
Block a user