Files
transcriber/internal/entity/job.go

44 lines
1008 B
Go

package entity
import (
"time"
)
type TranscribeJob struct {
Id string
State string
FileID *string
IsError bool
ErrorText *string
AcquisitionID *string
AcquireTime *time.Time
DelayTime *time.Time
RecognitionOpID *string // ID операции распознавания в Yandex Cloud
TranscriptionText *string // Результат распознавания
CreatedAt time.Time
UpdatedAt time.Time
}
const (
StateCreated = "created"
StateConverted = "converted"
StateUploaded = "uploaded"
StateTranscribe = "transcribe"
StateDone = "done"
StatusFailed = "failed"
)
func (j *TranscribeJob) MoveToState(state string) {
j.State = state
j.DelayTime = nil
j.AcquisitionID = nil
j.AcquireTime = nil
j.UpdatedAt = time.Now()
}
func (j *TranscribeJob) MoveToStateAndDelay(state string, delay *time.Time) {
j.MoveToState(state)
j.DelayTime = delay
j.UpdatedAt = time.Now()
}