71 lines
1.1 KiB
Go
71 lines
1.1 KiB
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 RPMFile struct {
|
|
TaskID int
|
|
Name string
|
|
Arch string
|
|
}
|
|
|
|
type TaskStatus int
|
|
|
|
const (
|
|
StatusPending TaskStatus = iota // 0
|
|
StatusInProgress // 1
|
|
StatusCompleted // 2
|
|
StatusFailed // 3
|
|
StatusCancelled // 4
|
|
)
|
|
|
|
type TaskType int
|
|
|
|
const (
|
|
// For future purpose
|
|
TypeTestOnly TaskType = iota // 0
|
|
TypeUpsert // 1
|
|
// For future purpose
|
|
TypeDelete // 2
|
|
)
|
|
|
|
type Task struct {
|
|
gorm.Model
|
|
|
|
ID int
|
|
Status TaskStatus
|
|
Type TaskType
|
|
|
|
RepoID int
|
|
Repo GitRepo
|
|
ALTRepoID int
|
|
ALTRepo ALTRepo
|
|
|
|
Files []RPMFile
|
|
}
|
|
|
|
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
|
|
}
|