Move document_records duty-slot writes into docgov, project ledger heads through docgov/freedoc ports, and workspace deliverable I/O through DeliverableStore so arch-check baseline drops to sql_write:1 path:13.
43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
|
|
"chat-agent-system/internal/app/uow"
|
|
"chat-agent-system/internal/authz"
|
|
"chat-agent-system/internal/docgov"
|
|
"chat-agent-system/internal/docrevision"
|
|
"chat-agent-system/internal/freedoc"
|
|
"chat-agent-system/internal/workspace"
|
|
)
|
|
|
|
func wireDutySlotWriter(a *authz.Authorizer) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
a.SetDutySlotWriter(docgov.DutySlotWriter{})
|
|
}
|
|
|
|
func wireDocRevisionPorts(rev *docrevision.Service) {
|
|
if rev == nil {
|
|
return
|
|
}
|
|
rev.SetRootPointerProjector(docrevision.CompositeRootPointerProjector{
|
|
Controlled: func(ctx context.Context, scope uow.TxScope, root *docrevision.DocRootPointers) error {
|
|
if root == nil {
|
|
return nil
|
|
}
|
|
return (docgov.Repository{}).ProjectHeadFull(ctx, scope, root.DocID,
|
|
root.LedgerVersionID, root.HeadSnapshotID, root.HeadRevisionNo, root.RevisionSchemaVer, root.ContentSHA256)
|
|
},
|
|
Freeform: func(ctx context.Context, scope uow.TxScope, root *docrevision.DocRootPointers) error {
|
|
if root == nil {
|
|
return nil
|
|
}
|
|
return (freedoc.Repository{}).ProjectHead(ctx, scope, root.DocID,
|
|
root.LedgerVersionID, root.HeadSnapshotID, root.HeadRevisionNo, root.RevisionSchemaVer)
|
|
},
|
|
})
|
|
rev.SetDeliverableStore(workspace.DirDeliverable{})
|
|
}
|