Hub 2.0 step 6: AI cap and markup per church
The cap and markup move from the licence to the customer (migrated), use is counted over all the church's installs under one lock per church, and the licence token carries the church's cap. Settings → AI shows product. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,9 +64,10 @@ async function releaseInfo(install, version, { v2 = false } = {}) {
|
||||
}
|
||||
|
||||
async function tokenFor(install) {
|
||||
const licence = install.licenceId ? await prisma.licence.findUnique({ where: { id: install.licenceId }, include: { customer: { select: { name: true } } } }) : null;
|
||||
const licence = install.licenceId ? await prisma.licence.findUnique({ where: { id: install.licenceId }, include: { customer: { select: { name: true, aiMonthlyCapCents: true } } } }) : null;
|
||||
if (!licence) return null;
|
||||
return licenceToken.sign(licenceToken.buildPayload(licence, install, licence.customer.name));
|
||||
// The AI cap in the token is the church's (Hub 2.0).
|
||||
return licenceToken.sign(licenceToken.buildPayload({ ...licence, aiMonthlyCapCents: licence.customer.aiMonthlyCapCents }, install, licence.customer.name));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user