diff --git a/common/models.go b/common/models.go index 298ac02..4398ea0 100644 --- a/common/models.go +++ b/common/models.go @@ -10,7 +10,7 @@ import ( // The type Model is exactly the same with gorm.Model (see jinzhu/gorm) // except the json tags that are needed for serializing the models type Model struct { - ID uint `json:",omitempty" gorm:"unique;primary_key:true"` + ID uint `json:"id,omitempty" gorm:"unique;primary_key:true"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` DeletedAt *time.Time `json:"-" sql:"index"` diff --git a/routes/user/user_endpoints.go b/routes/user/user_endpoints.go index fd442dc..628d792 100644 --- a/routes/user/user_endpoints.go +++ b/routes/user/user_endpoints.go @@ -168,10 +168,8 @@ func getUsers(c *gin.Context) { if common.ProvideErrorResponse(c, err) { return } - serializer := common.UsersSerializer{c, users} - c.JSON(http.StatusOK, gin.H{ - "users": serializer.Response(true), - }) + + c.JSON(http.StatusOK, gin.H{"users": users}) } // AddUser godoc