emdb/cmd/api-service/job/job.go

42 lines
584 B
Go
Raw Normal View History

2023-12-30 09:19:53 +01:00
package job
import (
2024-01-18 08:57:56 +01:00
"slices"
2023-12-30 09:19:53 +01:00
"time"
)
type JobStatus string
type Action string
const (
2024-01-18 07:56:25 +01:00
interval = 20 * time.Second
2023-12-30 09:19:53 +01:00
ActionRefreshIMDBReviews Action = "refresh-imdb-reviews"
ActionRefreshAllIMDBReviews Action = "refresh-all-imdb-reviews"
)
var (
validActions = []Action{
ActionRefreshIMDBReviews,
ActionRefreshAllIMDBReviews,
}
)
2023-12-30 09:19:53 +01:00
type Job struct {
ID int
MovieID string
Action Action
Status JobStatus
Created time.Time
Updated time.Time
2023-12-30 09:19:53 +01:00
}
2024-01-18 08:57:56 +01:00
func Valid(action Action) bool {
if slices.Contains(validActions, action) {
return true
}
return false
}