59 lines
1.2 KiB
Go
59 lines
1.2 KiB
Go
package usecase
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"cmroubao/backend-api/internal/domain"
|
|
)
|
|
|
|
type ExecutionResultAuthorization struct {
|
|
UserID string
|
|
DeviceID string
|
|
TaskID string
|
|
ExecutionID string
|
|
ClaimGeneration int64
|
|
ClaimTokenHash string
|
|
}
|
|
|
|
type ExecutionResultWrite struct {
|
|
ExecutionResultAuthorization
|
|
Operation string
|
|
IdempotencyKey string
|
|
RequestHash string
|
|
Now time.Time
|
|
}
|
|
|
|
type ExecutionResultRepository interface {
|
|
AppendExecutionEvents(
|
|
context.Context,
|
|
ExecutionResultWrite,
|
|
[]domain.ExecutionEvent,
|
|
) (bool, error)
|
|
CreateExecutionEvidence(
|
|
context.Context,
|
|
ExecutionResultWrite,
|
|
domain.ExecutionEvidenceAsset,
|
|
) (domain.ExecutionEvidenceAsset, bool, error)
|
|
StoreExecutionCandidates(
|
|
context.Context,
|
|
ExecutionResultWrite,
|
|
domain.ExecutionCandidateBatch,
|
|
) (bool, error)
|
|
CompleteExecution(
|
|
context.Context,
|
|
ExecutionResultWrite,
|
|
domain.ExecutionOutcome,
|
|
) (domain.PurchaseTask, bool, error)
|
|
FailExecution(
|
|
context.Context,
|
|
ExecutionResultWrite,
|
|
domain.ExecutionOutcome,
|
|
) (domain.PurchaseTask, bool, error)
|
|
GetExecutionEvidence(
|
|
context.Context,
|
|
string,
|
|
string,
|
|
) (domain.ExecutionEvidenceAsset, error)
|
|
}
|