emdb/job/job.go

50 lines
905 B
Go
Raw Permalink Normal View History

2023-12-30 09:19:53 +01:00
package job
2024-03-09 13:08:25 +01:00
import (
"slices"
"time"
)
type JobStatus string
type JobType string
2023-12-30 09:19:53 +01:00
const (
2024-03-09 13:08:25 +01:00
TypeSimple JobType = "simple"
TypeAI JobType = "ai"
ActionRefreshIMDBReviews = "refresh-imdb-reviews"
ActionRefreshAllIMDBReviews = "refresh-all-imdb-reviews"
ActionFindTitles = "find-titles"
ActionFindAllTitles = "find-all-titles"
)
var (
SimpleActions = []string{
ActionRefreshIMDBReviews,
ActionRefreshAllIMDBReviews, // just creates a job for each movie
ActionFindAllTitles, // just creates a job for each review
}
AIActions = []string{
ActionFindTitles,
}
ValidActions = append(SimpleActions, AIActions...)
)
2024-03-09 13:08:25 +01:00
type Job struct {
ID int
ActionID string
Action string
Status JobStatus
Created time.Time
Updated time.Time
}
func Valid(action string) bool {
if slices.Contains(ValidActions, action) {
return true
}
return false
}