fix(09): WR-19 expose the write transaction to hooks and scopes through TxFromContext

This commit is contained in:
Jakub Zych
2026-10-01 21:37:13 +02:00
parent bbdc7a6b7e
commit 4ae272e3cc
6 changed files with 80 additions and 0 deletions

View File

@@ -633,6 +633,7 @@ func (s RelationService) Link(ctx context.Context, cc *CompiledController, relat
}
var result RelationMutationResult
err = lagoon.Transaction(ctx, s.DB, func(ctx context.Context, tx *gorm.DB) error {
ctx = withTx(ctx, tx)
parent, err := newWritableModel(cc)
if err != nil {
return err
@@ -702,6 +703,7 @@ func (s RelationService) Unlink(ctx context.Context, cc *CompiledController, rel
}
var result RelationMutationResult
err = lagoon.Transaction(ctx, s.DB, func(ctx context.Context, tx *gorm.DB) error {
ctx = withTx(ctx, tx)
parent, err := newWritableModel(cc)
if err != nil {
return err