forked from mtusi2026/mtusi2026lab7
на оценку 4
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package domain
|
||||
|
||||
import "time"
|
||||
|
||||
const AttachmentJobType = "attachment.process.v1"
|
||||
|
||||
type AttachmentJobStatus string
|
||||
|
||||
const (
|
||||
AttachmentJobQueued AttachmentJobStatus = "queued"
|
||||
AttachmentJobProcessing AttachmentJobStatus = "processing"
|
||||
AttachmentJobSucceeded AttachmentJobStatus = "succeeded"
|
||||
AttachmentJobFailed AttachmentJobStatus = "failed"
|
||||
AttachmentJobSuperseded AttachmentJobStatus = "superseded"
|
||||
)
|
||||
|
||||
type AttachmentJob struct {
|
||||
SchemaVersion int
|
||||
JobID string
|
||||
Type string
|
||||
AttachmentID string
|
||||
PipelineVersion int
|
||||
Attempt int
|
||||
MaxAttempts int
|
||||
Status AttachmentJobStatus
|
||||
ErrorCode *string
|
||||
AvailableAt time.Time
|
||||
LeaseUntil *time.Time
|
||||
LeasedBy *string
|
||||
ReplayCount int
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
TraceParent string
|
||||
TraceState string
|
||||
}
|
||||
|
||||
type AttachmentJobMessage struct {
|
||||
SchemaVersion int `json:"schema_version"`
|
||||
JobID string `json:"job_id"`
|
||||
Type string `json:"type"`
|
||||
AttachmentID string `json:"attachment_id"`
|
||||
PipelineVersion int `json:"pipeline_version"`
|
||||
Attempt int `json:"attempt"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func (job AttachmentJob) Message() AttachmentJobMessage {
|
||||
return AttachmentJobMessage{
|
||||
SchemaVersion: job.SchemaVersion,
|
||||
JobID: job.JobID,
|
||||
Type: job.Type,
|
||||
AttachmentID: job.AttachmentID,
|
||||
PipelineVersion: job.PipelineVersion,
|
||||
Attempt: job.Attempt,
|
||||
CreatedAt: job.CreatedAt.UTC(),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user