Phase 14, part 1: plans, each team's account, and their limits

The multi-tenant edition's plans (Free and Paid as decided, or a plans
file) and each team's billing account, with a 14-day trial of Paid. A
team's plan caps what its people and agents may change: modules outside it
stay readable, a lapsed team changes nothing, and agents, Market entries,
crawls and background jobs keep to it. Without a Stripe key, no billing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 13:15:00 -07:00
co-authored by Claude Opus 5.5
parent e47764a78e
commit a47990f9bf
19 changed files with 848 additions and 7 deletions
+6
View File
@@ -13,6 +13,7 @@ import (
"supermarket/internal/appmail"
"supermarket/internal/audit"
"supermarket/internal/billing"
"supermarket/internal/profile"
"supermarket/internal/users"
)
@@ -182,6 +183,11 @@ func (s *Server) newTeam(owner *users.User, company, domain, site string, now ti
if err := users.Join(s.platform(), team.ID, owner.ID, users.Owner, nil, now); err != nil {
return nil, err
}
if s.billingOn() {
if err := billing.StartTrial(s.platform(), team.ID, s.Plans, now); err != nil {
return nil, err
}
}
ts, err := s.forTeam(team.ID)
if err != nil {
return nil, err