feat(app): add UnitOfWork and owner-bound repositories
Give each document command one postgres transaction and only let table owners unwrap the scope, so cross-owner writes can roll back together. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package freedoc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"chat-agent-system/internal/app/uow"
|
||||
)
|
||||
|
||||
// Repository is a M3 stub. M1 freeform projection stays on the existing service path.
|
||||
type Repository struct{}
|
||||
|
||||
func (Repository) ForbiddenInM1(ctx context.Context, scope uow.TxScope) error {
|
||||
if _, err := uow.AsPG(scope); err != nil {
|
||||
return err
|
||||
}
|
||||
return fmt.Errorf("freedoc: repository writes are not enabled until M3")
|
||||
}
|
||||
Reference in New Issue
Block a user