78 lines
1.1 KiB
Go
78 lines
1.1 KiB
Go
|
package models
|
||
|
|
||
|
import (
|
||
|
"gorm.io/gorm"
|
||
|
)
|
||
|
|
||
|
type ALTRepo struct {
|
||
|
gorm.Model
|
||
|
|
||
|
Name string `gorm:"uniqueIndex"`
|
||
|
}
|
||
|
|
||
|
type GitRepo struct {
|
||
|
gorm.Model
|
||
|
|
||
|
Name string `gorm:"uniqueIndex"`
|
||
|
}
|
||
|
|
||
|
type RPMFile struct {
|
||
|
gorm.Model
|
||
|
|
||
|
TaskID int
|
||
|
Task Task
|
||
|
|
||
|
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
|
||
|
|
||
|
Status TaskStatus
|
||
|
Type TaskType
|
||
|
|
||
|
RepoID uint
|
||
|
Repo *GitRepo
|
||
|
ALTRepoID uint
|
||
|
ALTRepo ALTRepo
|
||
|
|
||
|
FilesRemoved bool
|
||
|
Files []RPMFile
|
||
|
}
|
||
|
|
||
|
type GitRepoAltRepoTask struct {
|
||
|
gorm.Model
|
||
|
|
||
|
RepoID uint `gorm:"uniqueIndex:idx_gr_ar_gitaltrepotask"`
|
||
|
Repo *GitRepo
|
||
|
ALTRepoID uint `gorm:"uniqueIndex:idx_gr_ar_gitaltrepotask"`
|
||
|
ALTRepo *ALTRepo
|
||
|
|
||
|
LastTaskID *uint
|
||
|
LastTask *Task
|
||
|
|
||
|
CurrentTaskID *uint
|
||
|
CurrentTask *Task
|
||
|
}
|