2021-06-11 21:59:34 +03:00
|
|
|
package models
|
|
|
|
|
2021-12-26 19:23:37 +03:00
|
|
|
// ProjectLabelReverseResolver returns all projects for a given label
|
|
|
|
type ProjectLabelReverseResolver func(l string) []string
|
|
|
|
|
2021-06-11 21:59:34 +03:00
|
|
|
type ProjectLabel struct {
|
|
|
|
ID uint `json:"id" gorm:"primary_key"`
|
|
|
|
User *User `json:"-" gorm:"not null; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
|
2021-06-13 12:43:24 +03:00
|
|
|
UserID string `json:"-" gorm:"not null; index:idx_project_label_user"`
|
2021-06-11 21:59:34 +03:00
|
|
|
ProjectKey string `json:"project"`
|
|
|
|
Label string `json:"label" gorm:"type:varchar(64)"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *ProjectLabel) IsValid() bool {
|
|
|
|
return l.ProjectKey != "" && l.Label != ""
|
|
|
|
}
|