feat(cloud): fix upgrade/downgrade and migrate webhook handler

This commit is contained in:
Henry
2026-05-16 22:23:56 +01:00
parent 7d52e4eb88
commit f38533590d
2 changed files with 21 additions and 15 deletions

View File

@@ -87,6 +87,8 @@ export default withApiLogging(
const { event, license_key, license_status, tier, prev_license_key } =
payload;
log.info({ headers: req.headers, payload }, "partner webhook received");
const { db } = await createNextApiContext(req);
switch (event) {
@@ -141,7 +143,7 @@ export default withApiLogging(
const cfg = tierConfig(tier);
await subscriptionRepo.upsertByPartnerLicenseKey(db, license_key, {
plan: cfg.plan,
status: license_status,
status: "active",
partnerTier: tier,
seats: cfg.seats,
unlimitedSeats: cfg.unlimitedSeats,
@@ -163,7 +165,7 @@ export default withApiLogging(
const cfg = tierConfig(tier);
await subscriptionRepo.upsertByPartnerLicenseKey(db, license_key, {
plan: cfg.plan,
status: sub.status,
status: "active",
partnerTier: tier,
seats: cfg.seats,
unlimitedSeats: cfg.unlimitedSeats,