Make product API versions independently installable
This commit is contained in:
1 parent
ce6583f454
commit
d04c8b12ab
69 files changed
+755
-404
No files matched your search
@@ -243,6 +243,13 @@ func NewAccountService(
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &service{logger: logger, config: config, accountDB: stores.Accounts,
|
||||
vdb: stores.Verification, sessions: stores.RefreshTokens, transactions: dbf.TransactionFactory()}, nil
|
||||
return FromStores(l, config, stores, dbf.TransactionFactory())
|
||||
}
|
||||
|
||||
func FromStores(l mlogger.Logger, config *middleware.PasswordConfig, stores *authstorage.Stores, transactions transaction.Factory) (*service, error) {
|
||||
if config == nil || stores == nil || transactions == nil {
|
||||
return nil, merrors.InvalidArgument("customer dependencies are required")
|
||||
}
|
||||
return &service{logger: l.Named("account_service"), config: config, accountDB: stores.Accounts,
|
||||
vdb: stores.Verification, sessions: stores.RefreshTokens, transactions: transactions}, nil
|
||||
}
|
||||
@@ -2,11 +2,13 @@ package accountservice
|
||||
|
||||
import (
|
||||
"context"
|
||||
customermodel "git.sendico.io/tech/sxchnge/product/customers/model"
|
||||
|
||||
"git.sendico.io/tech/sxchnge/product/auth/config"
|
||||
authstorage "git.sendico.io/tech/sxchnge/product/auth/storage"
|
||||
accountserviceimp "git.sendico.io/tech/sxchnge/product/customers/internal"
|
||||
customermodel "git.sendico.io/tech/sxchnge/product/customers/model"
|
||||
"git.sendico.io/tech/sxchnge/shared/database"
|
||||
"git.sendico.io/tech/sxchnge/shared/database/transaction"
|
||||
"git.sendico.io/tech/sxchnge/shared/logging"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
@@ -61,3 +63,8 @@ func NewAccountService(
|
||||
) (AccountService, error) {
|
||||
return accountserviceimp.NewAccountService(logger, dbf, config, storageConfig)
|
||||
}
|
||||
|
||||
// FromStores composes a customer service using already initialized storage.
|
||||
func FromStores(logger mlogger.Logger, config *middleware.PasswordConfig, stores *authstorage.Stores, transactions transaction.Factory) (AccountService, error) {
|
||||
return accountserviceimp.FromStores(logger, config, stores, transactions)
|
||||
}
|
||||
Reference in new issue
Block a user