mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-28 21:25:55 +01:00
add json annotations for model
This commit is contained in:
parent
61f12f089d
commit
3229d9ea45
@ -16,7 +16,6 @@ package dao
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
// "fmt"
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
@ -116,11 +115,8 @@ func TestMain(m *testing.M) {
|
||||
os.Setenv("MYSQL_USR", dbUser)
|
||||
os.Setenv("MYSQL_PWD", dbPassword)
|
||||
os.Setenv("AUTH_MODE", "db_auth")
|
||||
fmt.Println("a")
|
||||
InitDB()
|
||||
fmt.Println("b")
|
||||
clearUp(username)
|
||||
fmt.Println("c")
|
||||
os.Exit(m.Run())
|
||||
|
||||
}
|
||||
|
@ -19,11 +19,11 @@ import (
|
||||
)
|
||||
|
||||
type AccessLog struct {
|
||||
LogID int `orm:"column(log_id)"`
|
||||
UserID int `orm:"column(user_id)"`
|
||||
ProjectID int64 `orm:"column(project_id)"`
|
||||
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)"`
|
||||
GUID string `orm:"column(GUID)"`
|
||||
GUID string `orm:"column(GUID)" json:"Guid"`
|
||||
Operation string `orm:"column(operation)"`
|
||||
OpTime time.Time `orm:"column(op_time)"`
|
||||
Username string
|
||||
|
@ -23,7 +23,7 @@ type Notification struct {
|
||||
}
|
||||
|
||||
type Event struct {
|
||||
ID string
|
||||
ID string `json:"Id"`
|
||||
TimeStamp time.Time
|
||||
Action string
|
||||
Target *Target
|
||||
@ -35,7 +35,7 @@ type Target struct {
|
||||
MediaType string
|
||||
Digest string
|
||||
Repository string
|
||||
URL string
|
||||
URL string `json:"Url"`
|
||||
}
|
||||
|
||||
type Actor struct {
|
||||
@ -43,7 +43,7 @@ type Actor struct {
|
||||
}
|
||||
|
||||
type Request struct {
|
||||
ID string
|
||||
ID string `json:"Id"`
|
||||
Method string
|
||||
UserAgent string
|
||||
}
|
||||
|
@ -19,13 +19,13 @@ import (
|
||||
)
|
||||
|
||||
type Project struct {
|
||||
ProjectID int64 `orm:"column(project_id)"`
|
||||
OwnerID int `orm:"column(owner_id)"`
|
||||
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
|
||||
UserID int `json:"UserId"`
|
||||
OwnerName string
|
||||
Public int `orm:"column(public)"`
|
||||
//This field does not have correspondent column in DB, this is just for UI to disable button
|
||||
|
@ -15,7 +15,7 @@
|
||||
package models
|
||||
|
||||
type ProjectRole struct {
|
||||
PrID int `orm:"column(pr_id)"`
|
||||
ProjectID int64 `orm:"column(project_id)"`
|
||||
RoleID int `orm:"column(role_id)"`
|
||||
PrID int `orm:"column(pr_id)" json:"PrId"`
|
||||
ProjectID int64 `orm:"column(project_id)" json:"ProjectId"`
|
||||
RoleID int `orm:"column(role_id)" json:"RoleId"`
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
package models
|
||||
|
||||
type User struct {
|
||||
UserID int `orm:"column(user_id)"`
|
||||
UserID int `orm:"column(user_id)" json:"UserId"`
|
||||
Username string `orm:"column(username)"`
|
||||
Email string `orm:"column(email)"`
|
||||
Password string `orm:"column(password)"`
|
||||
@ -23,9 +23,9 @@ type User struct {
|
||||
Comment string `orm:"column(comment)"`
|
||||
Deleted int `orm:"column(deleted)"`
|
||||
Rolename string
|
||||
RoleID int
|
||||
RoleID int `json:"RoleId"`
|
||||
RoleList []Role
|
||||
HasAdminRole int
|
||||
ResetUUID string `orm:"column(reset_uuid)"`
|
||||
ResetUUID string `orm:"column(reset_uuid)" json:"ResetUuid"`
|
||||
Salt string `orm:"column(salt)"`
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
package models
|
||||
|
||||
type UserProjectRole struct {
|
||||
UprID int `orm:"column(upr_id)"`
|
||||
UserID int `orm:"column(user_id)"`
|
||||
PrID int64 `orm:"column(pr_id)"`
|
||||
UprID int `orm:"column(upr_id)" json:"UprId"`
|
||||
UserID int `orm:"column(user_id)" json:"UserId"`
|
||||
PrID int64 `orm:"column(pr_id)" json:"PrId"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user