feat(evidence): project skill evidence from confirmed assessments

This commit is contained in:
shira committed 2026-10-09 11:25:19 +03:00
1 parent 4761508f13
commit c2a8d17195
94 files changed
+10077 -151

No files matched your search

+20 -8
View File
@@ -7,6 +7,7 @@ import (
"time"
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgxpool"
"lincodex/backend/config"
v1 "lincodex/backend/internal/adapter/primary/http/v1"
@@ -41,14 +42,7 @@ func newPrivacyHandler(
return nil, nil, fmt.Errorf("bootstrap.newPrivacyHandler - create pool: %w", err)
}
transactor := postgres.NewTransactor(pool)
projector := anonymousprofile.NewService(postgres.NewPrivacyCohortStore(pool), key, time.Now)
quota := companyquota.NewService(time.Now)
views, err := candidateview.NewService(candidateview.Dependencies{
Transactor: transactor, Projector: projector, PseudonymKey: key, Clock: time.Now,
Quota: func(ctx context.Context, unit outbound.UnitOfWork, organization domain.Organization, candidateID uuid.UUID) (outbound.CompanyQuotaDecision, error) {
return quota.ReserveCardView(ctx, unit, organization, candidateID)
},
})
views, err := newCandidateViewService(pool, transactor, key)
if err != nil {
pool.Close()
return nil, nil, fmt.Errorf("bootstrap.newPrivacyHandler - create view service: %w", err)
@@ -60,3 +54,21 @@ func newPrivacyHandler(
}
return v1.NewPrivacyHandler(views, privacy, settings.AppPublicURL), pool.Close, nil
}
// newCandidateViewService builds the organization card checks on the given
// pool. The privacy handler and the evidence handler each own a pool and a
// service, so their connection use stays separate.
func newCandidateViewService(
pool *pgxpool.Pool,
transactor *postgres.Transactor,
key domain.CandidateViewPseudonymKey,
) (*candidateview.Service, error) {
projector := anonymousprofile.NewService(postgres.NewPrivacyCohortStore(pool), key, time.Now)
quota := companyquota.NewService(time.Now)
return candidateview.NewService(candidateview.Dependencies{
Transactor: transactor, Projector: projector, PseudonymKey: key, Clock: time.Now,
Quota: func(ctx context.Context, unit outbound.UnitOfWork, organization domain.Organization, candidateID uuid.UUID) (outbound.CompanyQuotaDecision, error) {
return quota.ReserveCardView(ctx, unit, organization, candidateID)
},
})
}