package store import ( "context" "fmt" "time" "bountyboard/internal/ulid" ) // BountyAward is the immutable ledger row (§4.5) — never updated, never // recomputed from mutable tasks. type BountyAward struct { ID string `bson:"_id" json:"id"` TaskID string `bson:"taskId" json:"taskId"` DeveloperID string `bson:"developerId" json:"developerId"` ConsultantID string `bson:"consultantId" json:"consultantId"` CustomerID string `bson:"customerId" json:"customerId"` Amount float64 `bson:"amount" json:"amount"` Coefficient float64 `bson:"coefficient" json:"coefficient"` AwardedAt time.Time `bson:"awardedAt" json:"awardedAt"` } func (s *Store) InsertAward(ctx context.Context, a *BountyAward) error { a.ID = ulid.New() a.AwardedAt = time.Now().UTC() if _, err := s.DB.Collection("bountyAwards").InsertOne(ctx, a); err != nil { return fmt.Errorf("insert award: %w", err) } return nil }