* Use same name as other structs. * Sync with normal forms. * Edit description with API. * Workaround for nil value.
This commit is contained in:
parent
0590176a23
commit
8c8471e754
5 changed files with 22 additions and 14 deletions
|
@ -32,8 +32,9 @@ type EditUserOption struct {
|
||||||
FullName *string `json:"full_name" binding:"MaxSize(100)"`
|
FullName *string `json:"full_name" binding:"MaxSize(100)"`
|
||||||
Password string `json:"password" binding:"MaxSize(255)"`
|
Password string `json:"password" binding:"MaxSize(255)"`
|
||||||
MustChangePassword *bool `json:"must_change_password"`
|
MustChangePassword *bool `json:"must_change_password"`
|
||||||
Website *string `json:"website" binding:"MaxSize(50)"`
|
Website *string `json:"website" binding:"OmitEmpty;ValidUrl;MaxSize(255)"`
|
||||||
Location *string `json:"location" binding:"MaxSize(50)"`
|
Location *string `json:"location" binding:"MaxSize(50)"`
|
||||||
|
Description *string `json:"description" binding:"MaxSize(255)"`
|
||||||
Active *bool `json:"active"`
|
Active *bool `json:"active"`
|
||||||
Admin *bool `json:"admin"`
|
Admin *bool `json:"admin"`
|
||||||
AllowGitHook *bool `json:"allow_git_hook"`
|
AllowGitHook *bool `json:"allow_git_hook"`
|
||||||
|
|
|
@ -22,9 +22,9 @@ type CreateOrgOption struct {
|
||||||
// required: true
|
// required: true
|
||||||
UserName string `json:"username" binding:"Required"`
|
UserName string `json:"username" binding:"Required"`
|
||||||
FullName string `json:"full_name"`
|
FullName string `json:"full_name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description" binding:"MaxSize(255)"`
|
||||||
Website string `json:"website"`
|
Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
|
||||||
Location string `json:"location"`
|
Location string `json:"location" binding:"MaxSize(50)"`
|
||||||
// possible values are `public` (default), `limited` or `private`
|
// possible values are `public` (default), `limited` or `private`
|
||||||
// enum: public,limited,private
|
// enum: public,limited,private
|
||||||
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
|
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
|
||||||
|
@ -34,9 +34,9 @@ type CreateOrgOption struct {
|
||||||
// EditOrgOption options for editing an organization
|
// EditOrgOption options for editing an organization
|
||||||
type EditOrgOption struct {
|
type EditOrgOption struct {
|
||||||
FullName string `json:"full_name"`
|
FullName string `json:"full_name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description" binding:"MaxSize(255)"`
|
||||||
Website string `json:"website"`
|
Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
|
||||||
Location string `json:"location"`
|
Location string `json:"location" binding:"MaxSize(50)"`
|
||||||
// possible values are `public`, `limited` or `private`
|
// possible values are `public`, `limited` or `private`
|
||||||
// enum: public,limited,private
|
// enum: public,limited,private
|
||||||
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
|
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
|
||||||
|
|
|
@ -37,8 +37,8 @@ type User struct {
|
||||||
Location string `json:"location"`
|
Location string `json:"location"`
|
||||||
// the user's website
|
// the user's website
|
||||||
Website string `json:"website"`
|
Website string `json:"website"`
|
||||||
// the user's biography
|
// the user's description
|
||||||
Description string `json:"bio"`
|
Description string `json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON implements the json.Marshaler interface for User, adding field(s) for backward compatibility
|
// MarshalJSON implements the json.Marshaler interface for User, adding field(s) for backward compatibility
|
||||||
|
|
|
@ -203,6 +203,9 @@ func EditUser(ctx *context.APIContext) {
|
||||||
if form.Location != nil {
|
if form.Location != nil {
|
||||||
u.Location = *form.Location
|
u.Location = *form.Location
|
||||||
}
|
}
|
||||||
|
if form.Description != nil {
|
||||||
|
u.Description = *form.Description
|
||||||
|
}
|
||||||
if form.Active != nil {
|
if form.Active != nil {
|
||||||
u.IsActive = *form.Active
|
u.IsActive = *form.Active
|
||||||
}
|
}
|
||||||
|
|
|
@ -13800,6 +13800,10 @@
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"x-go-name": "AllowImportLocal"
|
"x-go-name": "AllowImportLocal"
|
||||||
},
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string",
|
||||||
|
"x-go-name": "Description"
|
||||||
|
},
|
||||||
"email": {
|
"email": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "email",
|
"format": "email",
|
||||||
|
@ -16251,16 +16255,16 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"x-go-name": "AvatarURL"
|
"x-go-name": "AvatarURL"
|
||||||
},
|
},
|
||||||
"bio": {
|
|
||||||
"description": "the user's biography",
|
|
||||||
"type": "string",
|
|
||||||
"x-go-name": "Description"
|
|
||||||
},
|
|
||||||
"created": {
|
"created": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
"x-go-name": "Created"
|
"x-go-name": "Created"
|
||||||
},
|
},
|
||||||
|
"description": {
|
||||||
|
"description": "the user's description",
|
||||||
|
"type": "string",
|
||||||
|
"x-go-name": "Description"
|
||||||
|
},
|
||||||
"email": {
|
"email": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "email",
|
"format": "email",
|
||||||
|
|
Loading…
Reference in a new issue