feat(user): add remark field to User model and form (#307)
This commit is contained in:
@@ -14,6 +14,7 @@ type UserForm struct {
|
||||
GroupId uint `json:"group_id" validate:"required"`
|
||||
IsAdmin *bool `json:"is_admin" `
|
||||
Status model.StatusCode `json:"status" validate:"required,gte=0"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
func (uf *UserForm) FromUser(user *model.User) *UserForm {
|
||||
@@ -25,6 +26,7 @@ func (uf *UserForm) FromUser(user *model.User) *UserForm {
|
||||
uf.GroupId = user.GroupId
|
||||
uf.IsAdmin = user.IsAdmin
|
||||
uf.Status = user.Status
|
||||
uf.Remark = user.Remark
|
||||
return uf
|
||||
}
|
||||
func (uf *UserForm) ToUser() *model.User {
|
||||
@@ -37,6 +39,7 @@ func (uf *UserForm) ToUser() *model.User {
|
||||
user.GroupId = uf.GroupId
|
||||
user.IsAdmin = uf.IsAdmin
|
||||
user.Status = uf.Status
|
||||
user.Remark = uf.Remark
|
||||
return user
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ type User struct {
|
||||
GroupId uint `json:"group_id" gorm:"default:0;not null;index"`
|
||||
IsAdmin *bool `json:"is_admin" gorm:"default:0;not null;"`
|
||||
Status StatusCode `json:"status" gorm:"default:1;not null;"`
|
||||
Remark string `json:"remark" gorm:"default:'';not null;"`
|
||||
TimeModel
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user