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:
@@ -28,6 +28,7 @@ import (
|
||||
"supermarket/internal/api/reddit"
|
||||
"supermarket/internal/api/twitter"
|
||||
"supermarket/internal/appmail"
|
||||
"supermarket/internal/billing"
|
||||
"supermarket/internal/content"
|
||||
"supermarket/internal/core"
|
||||
"supermarket/internal/db"
|
||||
@@ -81,6 +82,9 @@ type Server struct {
|
||||
// Platform is the database every team shares: people, sessions, keys,
|
||||
// locks. On the local and server editions, DB itself.
|
||||
Platform *db.DB
|
||||
// Plans are the multi-tenant edition's billing; nil: no billing, every
|
||||
// team has everything.
|
||||
Plans *billing.Plans
|
||||
|
||||
testPublisher func(*posting.Account) content.Publisher // tests: posts nowhere
|
||||
|
||||
@@ -244,6 +248,9 @@ func (s *Server) jobDo(ctx context.Context, name string, fn func(context.Context
|
||||
if name == "seo" && !ts.domainProved() {
|
||||
return // nothing crawled or read before the domain is proved
|
||||
}
|
||||
if !ts.jobAllowed(name) {
|
||||
return // its module isn't in the team's plan, or the team has lapsed
|
||||
}
|
||||
if _, err := ts.jobs().Do(ctx, ts.lockName("job:"+name), func(c context.Context) { fn(c, ts) }); err != nil {
|
||||
ts.Log.Warn("jobs: taking the lock", "job", name, "team", ts.team(), "err", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user