feat(accounts): add consent settings and organization management
This commit is contained in:
1 parent
24638d46d2
commit
391af7a1ef
83 files changed
+10198
-613
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"lincodex/backend/config"
|
||||
v1 "lincodex/backend/internal/adapter/primary/http/v1"
|
||||
"lincodex/backend/internal/adapter/secondary/postgres"
|
||||
"lincodex/backend/internal/usecase/consent"
|
||||
)
|
||||
|
||||
const consentPoolMaxConns = 4
|
||||
|
||||
func newConsentHandler(ctx context.Context, settings config.Config) (*v1.ConsentHandler, func(), error) {
|
||||
if settings.DatabaseURL == "" {
|
||||
return nil, func() {}, nil
|
||||
}
|
||||
pool, err := postgres.NewSizedPool(ctx, settings.DatabaseURL, consentPoolMaxConns)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
store := postgres.NewConsentStore(pool)
|
||||
reader := consent.NewQueryService(store, time.Now)
|
||||
commands := consent.NewService(postgres.NewTransactor(pool), time.Now)
|
||||
return v1.NewConsentHandler(reader, commands), pool.Close, nil
|
||||
}
|
||||
Reference in new issue
Block a user