forked from longtao.wu/droboticflow
25 lines
747 B
Go
25 lines
747 B
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"droboticflow/internal/domain"
|
|
"droboticflow/internal/store"
|
|
)
|
|
|
|
func (s *server) storeAnnotationMaterializationArtifact(ctx context.Context, t domain.AnnotationTaskRecord, run *domain.RunRecord, a domain.ExecutionArtifact) error {
|
|
if e := s.assertAnnotationLease(ctx); e != nil {
|
|
return e
|
|
}
|
|
if db, ok := s.store.(store.AnnotationProcessingStore); ok {
|
|
return db.AppendAnnotationArtifact(ctx, t.OrganizationID, t.NodeID, a)
|
|
}
|
|
run.Artifacts = append(run.Artifacts, a)
|
|
for i := range run.NodeExecutions {
|
|
if run.NodeExecutions[i].NodeID == t.NodeID {
|
|
run.NodeExecutions[i].Artifacts = append(run.NodeExecutions[i].Artifacts, a)
|
|
}
|
|
}
|
|
run.UpdatedAt = nowISO()
|
|
return s.store.UpsertRun(ctx, *run)
|
|
}
|