feat(profile): persist candidate edits and enforce company access
This commit is contained in:
1 parent
3ab6bd91a3
commit
73c7caa225
67 files changed
+5286
-229
No files matched your search
@@ -0,0 +1,42 @@
|
||||
package outbound
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"lincodex/backend/internal/domain"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrCandidateProfileVersionConflict reports a stale expected version.
|
||||
ErrCandidateProfileVersionConflict = errors.New("candidate profile changed concurrently")
|
||||
|
||||
// ErrCandidateProfileHistoryTooLarge reports a snapshot that exceeds the
|
||||
// private history table's fixed storage bound.
|
||||
ErrCandidateProfileHistoryTooLarge = errors.New("candidate profile history snapshot exceeds its bound")
|
||||
)
|
||||
|
||||
// CandidateProfileRepositories exposes the candidate profile repository.
|
||||
// UnitOfWork binds it to the transaction that also records profile history
|
||||
// and advances onboarding.
|
||||
type CandidateProfileRepositories interface {
|
||||
CandidateProfiles() CandidateProfileRepository
|
||||
}
|
||||
|
||||
// CandidateProfileRepository reads and replaces only the profile identified
|
||||
// by userID. A missing profile row is the version-0 empty profile.
|
||||
type CandidateProfileRepository interface {
|
||||
Get(ctx context.Context, userID uuid.UUID) (domain.CandidateProfile, error)
|
||||
|
||||
// Save writes a changed profile only when its stored version equals
|
||||
// expectedVersion. It replaces claims and period acknowledgements and
|
||||
// appends the bounded immutable snapshot in the same transaction.
|
||||
Save(ctx context.Context, expectedVersion int64, profile domain.CandidateProfile) (domain.CandidateProfile, error)
|
||||
|
||||
// AdvanceOnboarding advances a verified candidate only from
|
||||
// candidate_profile to candidate_questionnaire. A later step is left alone.
|
||||
AdvanceOnboarding(ctx context.Context, userID uuid.UUID, at time.Time) error
|
||||
}
|
||||
@@ -50,6 +50,7 @@ type Transactor interface {
|
||||
type UnitOfWork interface {
|
||||
IdentityRepositories
|
||||
ConsentRepositories
|
||||
CandidateProfileRepositories
|
||||
AccountDeletionRequests() AccountDeletionRequests
|
||||
ConsentRevocationEffects() ConsentRevocationEffects
|
||||
OrganizationRepositories
|
||||
|
||||
Reference in new issue
Block a user