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