diff --git a/api/member.go b/api/member.go index b86e36f5d..685dc132e 100644 --- a/api/member.go +++ b/api/member.go @@ -33,7 +33,7 @@ type ProjectMemberAPI struct { } type memberReq struct { - Username string `json:"user_name"` + Username string `json:"username"` UserID int `json:"user_id"` Roles []int `json:"roles"` } @@ -104,7 +104,7 @@ func (pma *ProjectMemberAPI) Get() { log.Errorf("Error occurred in GetUser, error: %v", err) pma.CustomAbort(http.StatusInternalServerError, "Internal error.") } - result["user_name"] = user.Username + result["username"] = user.Username result["user_id"] = pma.memberID result["roles"] = roleList pma.Data["json"] = result diff --git a/models/accesslog.go b/models/accesslog.go index 3111e3a44..8a34867e7 100644 --- a/models/accesslog.go +++ b/models/accesslog.go @@ -21,14 +21,14 @@ import ( // AccessLog holds information about logs which are used to record the actions that user take to the resourses. type AccessLog struct { - LogID int `orm:"column(log_id)" json:"LogId"` - UserID int `orm:"column(user_id)" json:"UserId"` - ProjectID int64 `orm:"column(project_id)" json:"ProjectId"` - RepoName string `orm:"column(repo_name)"` - RepoTag string `orm:"column(repo_tag)"` - GUID string `orm:"column(GUID)" json:"Guid"` - Operation string `orm:"column(operation)"` - OpTime time.Time `orm:"column(op_time)"` + LogID int `orm:"column(log_id)" json:"log_id"` + UserID int `orm:"column(user_id)" json:"user_id"` + ProjectID int64 `orm:"column(project_id)" json:"project_id"` + RepoName string `orm:"column(repo_name)" json:"repo_name"` + RepoTag string `orm:"column(repo_tag)" json:"repo_tag"` + GUID string `orm:"column(GUID)" json:"guid"` + Operation string `orm:"column(operation)" json:"operation"` + OpTime time.Time `orm:"column(op_time)" json:"op_time"` Username string Keywords string diff --git a/models/project.go b/models/project.go index 2ebd5fc32..4af9523b0 100644 --- a/models/project.go +++ b/models/project.go @@ -21,19 +21,19 @@ import ( // Project holds the details of a project. type Project struct { - ProjectID int64 `orm:"column(project_id)" json:"ProjectId"` - OwnerID int `orm:"column(owner_id)" json:"OwnerId"` - Name string `orm:"column(name)"` - CreationTime time.Time `orm:"column(creation_time)"` - CreationTimeStr string - Deleted int `orm:"column(deleted)"` - UserID int `json:"UserId"` - OwnerName string - Public int `orm:"column(public)"` + ProjectID int64 `orm:"column(project_id)" json:"project_id"` + OwnerID int `orm:"column(owner_id)" json:"owner_id"` + Name string `orm:"column(name)" json:"name"` + CreationTime time.Time `orm:"column(creation_time)" json:"creation_time"` + CreationTimeStr string `json:"creation_time_str"` + Deleted int `orm:"column(deleted) json:"deleted""` + //UserID int `json:"UserId"` + OwnerName string `json:"owner_name"` + Public int `orm:"column(public) json:"public"` //This field does not have correspondent column in DB, this is just for UI to disable button Togglable bool 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"` } diff --git a/models/user.go b/models/user.go index 29fb41c13..80d8eb004 100644 --- a/models/user.go +++ b/models/user.go @@ -21,18 +21,18 @@ import ( // User holds the details of a user. type User struct { - UserID int `orm:"column(user_id)" json:"UserId"` - Username string `orm:"column(username)" json:"username"` - Email string `orm:"column(email)" json:"email"` - Password string `orm:"column(password)" json:"password"` - Realname string `orm:"column(realname)" json:"realname"` - Comment string `orm:"column(comment)" json:"comment"` - Deleted int `orm:"column(deleted)"` - Rolename string - RoleID int `json:"RoleId"` - RoleList []Role - HasAdminRole int `orm:"column(sysadmin_flag)"` - ResetUUID string `orm:"column(reset_uuid)" json:"ResetUuid"` + UserID int `orm:"column(user_id)" json:"user_id"` + Username string `orm:"column(username)" json:"username"` + Email string `orm:"column(email)" json:"email"` + Password string `orm:"column(password)" json:"password"` + Realname string `orm:"column(realname)" json:"realname"` + Comment string `orm:"column(comment)" json:"comment"` + Deleted int `orm:"column(deleted)" json:"deleted"` + // Rolename string `json:role_name` + // RoleID int `json:"role_id"` + // RoleList []Role `json:"role_list"` + HasAdminRole int `orm:"column(sysadmin_flag)" json:"has_admin_role"` + ResetUUID string `orm:"column(reset_uuid)" json:"reset_uuid"` Salt string `orm:"column(salt)"` CreationTime time.Time `orm:"creation_time" json:"creation_time"`