71 lines
2.4 KiB
Go
71 lines
2.4 KiB
Go
package outbound
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
"lincodex/backend/internal/domain"
|
|
)
|
|
|
|
// MaxEvidencePageSize bounds one page of the candidate's own facts.
|
|
const MaxEvidencePageSize = 100
|
|
|
|
// EvidencePosition is the descending key of the candidate's fact list.
|
|
type EvidencePosition struct {
|
|
OccurredAt time.Time
|
|
ID uuid.UUID
|
|
}
|
|
|
|
// EvidenceListQuery selects one owner-scoped page of facts.
|
|
type EvidenceListQuery struct {
|
|
CandidateID uuid.UUID
|
|
After *EvidencePosition
|
|
Limit int32
|
|
}
|
|
|
|
// EvidenceFactPage is one page of the candidate's facts, newest event first.
|
|
type EvidenceFactPage struct {
|
|
Items []domain.EvidenceFact
|
|
HasMore bool
|
|
}
|
|
|
|
// EvidencePositionOf creates the continuation key for a fact.
|
|
func EvidencePositionOf(fact domain.EvidenceFact) EvidencePosition {
|
|
snapshot := fact.Snapshot()
|
|
return EvidencePosition{OccurredAt: snapshot.OccurredAt, ID: snapshot.ID}
|
|
}
|
|
|
|
// EvidenceRepository reads the skill evidence projection. It never reads an
|
|
// assessment result, answer, attempt, or review: the projection is the only
|
|
// source, so no answer, failure, or anti-cheat datum can reach a caller.
|
|
type EvidenceRepository interface {
|
|
// ListCandidateFacts returns one page of the facts that belong to the
|
|
// candidate, hidden ones included.
|
|
ListCandidateFacts(ctx context.Context, query EvidenceListQuery) (EvidenceFactPage, error)
|
|
|
|
// ListOrganizationFacts returns the evidence that one organization may read
|
|
// about one candidate: for each category of the card, the one fact that
|
|
// supports its confirmed grade. The adapter must select from
|
|
// candidate_effective_publications, exclude the candidates that hide the
|
|
// organization in the same statement, require the published card to carry
|
|
// the categories field, and return only visible measurements. The caller
|
|
// has already authorized the active organization membership and passes the
|
|
// categories that the card just projected.
|
|
ListOrganizationFacts(
|
|
ctx context.Context,
|
|
organizationID, candidateID uuid.UUID,
|
|
categories []domain.CandidateViewCategory,
|
|
) ([]domain.EvidenceOrganizationFact, error)
|
|
|
|
// ListPreviewFacts returns the same selection for the candidate's own card
|
|
// preview. It applies no organization and no cohort, and the caller has
|
|
// locked the effective C2 and publication.
|
|
ListPreviewFacts(
|
|
ctx context.Context,
|
|
candidateID uuid.UUID,
|
|
categories []domain.CandidateViewCategory,
|
|
) ([]domain.EvidenceOrganizationFact, error)
|
|
}
|