feat: add assessment, privacy and support flows

This commit is contained in:
TakuyaYagam1 committed 2026-10-08 08:08:25 +03:00
1 parent ee3738ee73
commit e4f24fa202
339 files changed
+56454 -1126

No files matched your search

+47
View File
@@ -3,6 +3,7 @@ package outbound
import (
"context"
"errors"
"time"
"github.com/google/uuid"
@@ -21,12 +22,21 @@ var (
// surrounding transaction remains safe to roll back and the API maps the
// conflict to its current 412 contract.
ErrNeedVersionConflict = errors.New("organization need changed concurrently")
// ErrNeedCreationResultNotFound reports a missing immutable response for a
// live idempotency record.
ErrNeedCreationResultNotFound = errors.New("organization need creation result not found")
)
// MaxNeedPageSize is the largest organization-scoped page in the contract.
const MaxNeedPageSize = 100
// NeedRepositories exposes tenant-scoped need storage bound to one
// UnitOfWork transaction.
type NeedRepositories interface {
Needs() NeedRepository
NeedLists() NeedListRepository
NeedCreationResults() NeedCreationResultRepository
}
// NeedRepository stores the current organization need and its immutable
@@ -48,3 +58,40 @@ type NeedRepository interface {
// rolls back both writes if either write fails.
Save(ctx context.Context, organizationID, needID uuid.UUID, expectedVersion int64, next domain.Need) error
}
// NeedListRepository reads one bounded, organization-scoped page of needs.
type NeedListRepository interface {
List(ctx context.Context, query NeedListQuery) (NeedPage, error)
}
// NeedCreationResultRepository stores the immutable public result produced by
// a successful idempotent create command. The scope references the generic
// idempotency record, so it is removed when that record is purged.
type NeedCreationResultRepository interface {
SaveCreationResult(ctx context.Context, scope [IdempotencyDigestSize]byte, snapshot domain.NeedResponseSnapshot) error
GetCreationResult(ctx context.Context, scope [IdempotencyDigestSize]byte) (domain.NeedResponseSnapshot, error)
}
// NeedListQuery selects one page within a single organization.
type NeedListQuery struct {
OrganizationID uuid.UUID
After *NeedListPosition
Limit int32
}
// NeedListPosition is the stable newest-first ordering key for pagination.
type NeedListPosition struct {
CreatedAt time.Time
NeedID uuid.UUID
}
// NeedPage contains one organization-scoped page of needs.
type NeedPage struct {
Items []domain.Need
HasMore bool
}
// NeedCreationPosition returns the pagination key for one need.
func NeedCreationPosition(need domain.Need) NeedListPosition {
return NeedListPosition{CreatedAt: need.CreatedAt(), NeedID: need.ID()}
}