58 lines
885 B
Go
58 lines
885 B
Go
|
package models
|
||
|
|
||
|
import "gorm.io/gorm"
|
||
|
|
||
|
type ALTRepo struct {
|
||
|
gorm.Model
|
||
|
|
||
|
ID int
|
||
|
Name string `gorm:"uniqueIndex"`
|
||
|
}
|
||
|
|
||
|
type GitRepo struct {
|
||
|
ID int
|
||
|
Name string `gorm:"uniqueIndex"`
|
||
|
}
|
||
|
|
||
|
type RPMFiles struct {
|
||
|
TaskID int
|
||
|
Name string
|
||
|
}
|
||
|
|
||
|
type TaskStatus int
|
||
|
|
||
|
const (
|
||
|
StatusPending TaskStatus = iota // 0
|
||
|
StatusInProgress // 1
|
||
|
StatusCompleted // 2
|
||
|
StatusFailed // 3
|
||
|
StatusCancelled // 4
|
||
|
)
|
||
|
|
||
|
type Task struct {
|
||
|
gorm.Model
|
||
|
|
||
|
ID int
|
||
|
Status TaskStatus
|
||
|
|
||
|
RepoID int
|
||
|
Repo GitRepo
|
||
|
ALTRepoID int
|
||
|
ALTRepo ALTRepo
|
||
|
|
||
|
RPMFiles []RPMFiles
|
||
|
}
|
||
|
|
||
|
type GitRepoAltRepoTask struct {
|
||
|
gorm.Model
|
||
|
|
||
|
ID int
|
||
|
|
||
|
RepoID int `gorm:"uniqueIndex:idx_gr_ar_gitaltrepotask"`
|
||
|
Repo GitRepo
|
||
|
ALTRepoID int `gorm:"uniqueIndex:idx_gr_ar_gitaltrepotask"`
|
||
|
ALTRepo ALTRepo
|
||
|
TaskID int
|
||
|
Task Task
|
||
|
}
|