feat: persist candidate questionnaires and enforce company quotas
This commit is contained in:
1 parent
73c7caa225
commit
3a61a8e8bb
51 files changed
+6280
-38
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"time"
|
||||
|
||||
"lincodex/backend/config"
|
||||
v1 "lincodex/backend/internal/adapter/primary/http/v1"
|
||||
"lincodex/backend/internal/adapter/secondary/postgres"
|
||||
"lincodex/backend/internal/usecase/questionnaire"
|
||||
)
|
||||
|
||||
const questionnairePoolMaxConns = 8
|
||||
|
||||
func newQuestionnaireHandler(ctx context.Context, settings config.Config, logger *slog.Logger) (*v1.QuestionnaireHandler, func(), error) {
|
||||
if settings.DatabaseURL == "" {
|
||||
logger.Warn("candidate questionnaire operations are not served because DATABASE_URL is not set")
|
||||
return nil, func() {}, nil
|
||||
}
|
||||
pool, err := postgres.NewSizedPool(ctx, settings.DatabaseURL, questionnairePoolMaxConns)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
service := questionnaire.NewService(postgres.NewTransactor(pool), time.Now)
|
||||
return v1.NewQuestionnaireHandler(service), pool.Close, nil
|
||||
}
|
||||
Reference in new issue
Block a user