diff --git a/internal/manager/persistence/jobs.go b/internal/manager/persistence/jobs.go index 79adaa38..b898a91f 100644 --- a/internal/manager/persistence/jobs.go +++ b/internal/manager/persistence/jobs.go @@ -36,10 +36,10 @@ type Job struct { gorm.Model UUID string `gorm:"type:char(36);not null;unique;index"` - Name string `gorm:"type:varchar(64);not null"` - JobType string `gorm:"type:varchar(32);not null"` - Priority int `gorm:"type:smallint;not null"` - Status string `gorm:"type:varchar(32);not null"` // See JobStatusXxxx consts in openapi_types.gen.go + Name string `gorm:"type:varchar(64);not null"` + JobType string `gorm:"type:varchar(32);not null"` + Priority int `gorm:"type:smallint;not null"` + Status api.JobStatus `gorm:"type:varchar(32);not null"` Settings StringInterfaceMap `gorm:"type:jsonb"` Metadata StringStringMap `gorm:"type:jsonb"` @@ -119,7 +119,7 @@ func (db *DB) StoreAuthoredJob(ctx context.Context, authoredJob job_compilers.Au UUID: authoredJob.JobID, Name: authoredJob.Name, JobType: authoredJob.JobType, - Status: string(authoredJob.Status), + Status: authoredJob.Status, Priority: authoredJob.Priority, Settings: StringInterfaceMap(authoredJob.Settings), Metadata: StringStringMap(authoredJob.Metadata), diff --git a/internal/manager/persistence/jobs_test.go b/internal/manager/persistence/jobs_test.go index a30d9940..4e0924a7 100644 --- a/internal/manager/persistence/jobs_test.go +++ b/internal/manager/persistence/jobs_test.go @@ -105,7 +105,7 @@ func TestStoreAuthoredJob(t *testing.T) { assert.Equal(t, job.Name, fetchedJob.Name) assert.Equal(t, job.JobType, fetchedJob.JobType) assert.Equal(t, job.Priority, fetchedJob.Priority) - assert.Equal(t, string(api.JobStatusUnderConstruction), fetchedJob.Status) + assert.Equal(t, api.JobStatusUnderConstruction, fetchedJob.Status) assert.EqualValues(t, map[string]interface{}(job.Settings), fetchedJob.Settings) assert.EqualValues(t, map[string]string(job.Metadata), fetchedJob.Metadata) diff --git a/internal/manager/persistence/task_scheduler_test.go b/internal/manager/persistence/task_scheduler_test.go index 3ce0286e..69aa641f 100644 --- a/internal/manager/persistence/task_scheduler_test.go +++ b/internal/manager/persistence/task_scheduler_test.go @@ -181,7 +181,7 @@ func constructTestJob( assert.NoError(t, err) // Queue the job. - dbJob.Status = string(api.JobStatusQueued) + dbJob.Status = api.JobStatusQueued err = db.SaveJobStatus(ctx, dbJob) assert.NoError(t, err)