update attributes of api

This commit is contained in:
Tan Jiang 2016-06-01 15:17:05 +08:00
parent a4d318dffe
commit bf86f1ff58
4 changed files with 32 additions and 32 deletions

View File

@ -33,7 +33,7 @@ type ProjectMemberAPI struct {
} }
type memberReq struct { type memberReq struct {
Username string `json:"user_name"` Username string `json:"username"`
UserID int `json:"user_id"` UserID int `json:"user_id"`
Roles []int `json:"roles"` Roles []int `json:"roles"`
} }
@ -104,7 +104,7 @@ func (pma *ProjectMemberAPI) Get() {
log.Errorf("Error occurred in GetUser, error: %v", err) log.Errorf("Error occurred in GetUser, error: %v", err)
pma.CustomAbort(http.StatusInternalServerError, "Internal error.") pma.CustomAbort(http.StatusInternalServerError, "Internal error.")
} }
result["user_name"] = user.Username result["username"] = user.Username
result["user_id"] = pma.memberID result["user_id"] = pma.memberID
result["roles"] = roleList result["roles"] = roleList
pma.Data["json"] = result pma.Data["json"] = result

View File

@ -21,14 +21,14 @@ import (
// AccessLog holds information about logs which are used to record the actions that user take to the resourses. // AccessLog holds information about logs which are used to record the actions that user take to the resourses.
type AccessLog struct { type AccessLog struct {
LogID int `orm:"column(log_id)" json:"LogId"` LogID int `orm:"column(log_id)" json:"log_id"`
UserID int `orm:"column(user_id)" json:"UserId"` UserID int `orm:"column(user_id)" json:"user_id"`
ProjectID int64 `orm:"column(project_id)" json:"ProjectId"` ProjectID int64 `orm:"column(project_id)" json:"project_id"`
RepoName string `orm:"column(repo_name)"` RepoName string `orm:"column(repo_name)" json:"repo_name"`
RepoTag string `orm:"column(repo_tag)"` RepoTag string `orm:"column(repo_tag)" json:"repo_tag"`
GUID string `orm:"column(GUID)" json:"Guid"` GUID string `orm:"column(GUID)" json:"guid"`
Operation string `orm:"column(operation)"` Operation string `orm:"column(operation)" json:"operation"`
OpTime time.Time `orm:"column(op_time)"` OpTime time.Time `orm:"column(op_time)" json:"op_time"`
Username string Username string
Keywords string Keywords string

View File

@ -21,19 +21,19 @@ import (
// Project holds the details of a project. // Project holds the details of a project.
type Project struct { type Project struct {
ProjectID int64 `orm:"column(project_id)" json:"ProjectId"` ProjectID int64 `orm:"column(project_id)" json:"project_id"`
OwnerID int `orm:"column(owner_id)" json:"OwnerId"` OwnerID int `orm:"column(owner_id)" json:"owner_id"`
Name string `orm:"column(name)"` Name string `orm:"column(name)" json:"name"`
CreationTime time.Time `orm:"column(creation_time)"` CreationTime time.Time `orm:"column(creation_time)" json:"creation_time"`
CreationTimeStr string CreationTimeStr string `json:"creation_time_str"`
Deleted int `orm:"column(deleted)"` Deleted int `orm:"column(deleted) json:"deleted""`
UserID int `json:"UserId"` //UserID int `json:"UserId"`
OwnerName string OwnerName string `json:"owner_name"`
Public int `orm:"column(public)"` Public int `orm:"column(public) json:"public"`
//This field does not have correspondent column in DB, this is just for UI to disable button //This field does not have correspondent column in DB, this is just for UI to disable button
Togglable bool Togglable bool
UpdateTime time.Time `orm:"update_time" json:"update_time"` UpdateTime time.Time `orm:"update_time" json:"update_time"`
Role int `json:"role_id"` Role int `json:"current_user_role_id"`
RepoCount int `json:"repo_count"` RepoCount int `json:"repo_count"`
} }

View File

@ -21,18 +21,18 @@ import (
// User holds the details of a user. // User holds the details of a user.
type User struct { type User struct {
UserID int `orm:"column(user_id)" json:"UserId"` UserID int `orm:"column(user_id)" json:"user_id"`
Username string `orm:"column(username)" json:"username"` Username string `orm:"column(username)" json:"username"`
Email string `orm:"column(email)" json:"email"` Email string `orm:"column(email)" json:"email"`
Password string `orm:"column(password)" json:"password"` Password string `orm:"column(password)" json:"password"`
Realname string `orm:"column(realname)" json:"realname"` Realname string `orm:"column(realname)" json:"realname"`
Comment string `orm:"column(comment)" json:"comment"` Comment string `orm:"column(comment)" json:"comment"`
Deleted int `orm:"column(deleted)"` Deleted int `orm:"column(deleted)" json:"deleted"`
Rolename string // Rolename string `json:role_name`
RoleID int `json:"RoleId"` // RoleID int `json:"role_id"`
RoleList []Role // RoleList []Role `json:"role_list"`
HasAdminRole int `orm:"column(sysadmin_flag)"` HasAdminRole int `orm:"column(sysadmin_flag)" json:"has_admin_role"`
ResetUUID string `orm:"column(reset_uuid)" json:"ResetUuid"` ResetUUID string `orm:"column(reset_uuid)" json:"reset_uuid"`
Salt string `orm:"column(salt)"` Salt string `orm:"column(salt)"`
CreationTime time.Time `orm:"creation_time" json:"creation_time"` CreationTime time.Time `orm:"creation_time" json:"creation_time"`