mirror of
https://github.com/luxfi/captable.git
synced 2026-10-30 17:01:02 +00:00
Merged from luxfi/transfer into captable for single-library TA engine: - pkg/voting: Proxy voting proposals, vote casting, quorum tracking, results aggregation (board elections, mergers, amendments) - pkg/comms: Investor communications — notices (proxy, dividend, regulatory, K-1), recipient tracking, delivery/read status - pkg/disclosure: Investor disclosures — PPM, subscription agreements, supplements, annual reports. Delivery + acknowledgment tracking. All follow captable's repository pattern (types.go + repository.go + service.go).
49 lines
1.0 KiB
Go
49 lines
1.0 KiB
Go
package comms
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
// Service provides investor communication operations.
|
|
type Service struct {
|
|
repo Repository
|
|
}
|
|
|
|
func NewService(repo Repository) *Service {
|
|
return &Service{repo: repo}
|
|
}
|
|
|
|
// Create saves a new investor notice.
|
|
func (s *Service) Create(ctx context.Context, n *Notice) error {
|
|
if n.Subject == "" {
|
|
return fmt.Errorf("subject required")
|
|
}
|
|
if n.CompanyID == "" {
|
|
return fmt.Errorf("company_id required")
|
|
}
|
|
if n.Type == "" {
|
|
n.Type = "general"
|
|
}
|
|
if n.CreatedAt.IsZero() {
|
|
n.CreatedAt = time.Now().UTC()
|
|
}
|
|
return s.repo.CreateNotice(ctx, n)
|
|
}
|
|
|
|
// Get returns a notice by ID.
|
|
func (s *Service) Get(ctx context.Context, id string) (*Notice, error) {
|
|
return s.repo.GetNotice(ctx, id)
|
|
}
|
|
|
|
// List returns notices matching the filter.
|
|
func (s *Service) List(ctx context.Context, filter NoticeFilter) ([]*Notice, error) {
|
|
return s.repo.ListNotices(ctx, filter)
|
|
}
|
|
|
|
// Send marks a notice as sent.
|
|
func (s *Service) Send(ctx context.Context, id string) error {
|
|
return s.repo.MarkSent(ctx, id)
|
|
}
|