2026-02-16 16:26:43: merge [main:5ee9d8568258a2e35dfce4aba80a607d007c2f0c];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s

This commit is contained in:
txix committed 2026-02-16 16:26:43 +03:00
1 parent aebc53174b
commit 0ad3e3dead
41 files changed
+1378 -239

No files matched your search

+14 -1
View File
@@ -3,9 +3,11 @@ package transaction
import (
"context"
"github.com/txix-open/isp-kit/db"
"msp-admin-service/repository"
"msp-admin-service/service"
"msp-admin-service/service/session_worker"
"github.com/txix-open/isp-kit/db"
)
type Manager struct {
@@ -25,6 +27,10 @@ type userTx struct {
repository.Token
}
type tokenTx struct {
repository.Token
}
func (m Manager) UserTransaction(ctx context.Context, msgTx func(ctx context.Context, tx service.UserTransaction) error) error {
return m.db.RunInTransaction(ctx, func(ctx context.Context, tx *db.Tx) error {
user := repository.NewUser(tx)
@@ -44,3 +50,10 @@ func (m Manager) AuthTransaction(ctx context.Context, msgTx func(ctx context.Con
return msgTx(ctx, userTx{user, role, userRole, token})
})
}
func (m Manager) TokenTransaction(ctx context.Context, msgTx func(ctx context.Context, tx session_worker.TokenTransaction) error) error {
return m.db.RunInTransaction(ctx, func(ctx context.Context, tx *db.Tx) error {
token := repository.NewToken(tx)
return msgTx(ctx, tokenTx{token})
})
}