Derpecates UsersSerializer() from user endpoints

This commit is contained in:
smavros 2019-08-13 16:17:37 +02:00
parent 50b1902bf3
commit 28d81e52c2
2 changed files with 3 additions and 5 deletions

View file

@ -10,7 +10,7 @@ import (
// The type Model is exactly the same with gorm.Model (see jinzhu/gorm) // The type Model is exactly the same with gorm.Model (see jinzhu/gorm)
// except the json tags that are needed for serializing the models // except the json tags that are needed for serializing the models
type Model struct { 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:"-"` CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `json:"-" sql:"index"` DeletedAt *time.Time `json:"-" sql:"index"`

View file

@ -168,10 +168,8 @@ func getUsers(c *gin.Context) {
if common.ProvideErrorResponse(c, err) { if common.ProvideErrorResponse(c, err) {
return return
} }
serializer := common.UsersSerializer{c, users}
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{"users": users})
"users": serializer.Response(true),
})
} }
// AddUser godoc // AddUser godoc