update subscription algorithm
This commit is contained in:
@@ -296,3 +296,22 @@ export async function updateMarketplaceHomepage(homepage: any, adminId: string,
|
||||
})
|
||||
return saved
|
||||
}
|
||||
|
||||
export function getPricingConfigs() {
|
||||
return repo.listPricingConfigs()
|
||||
}
|
||||
|
||||
export async function updatePricingConfigs(entries: { plan: string; billingPeriod: string; amount: number }[], adminId: string, ip?: string) {
|
||||
const results = await Promise.all(
|
||||
entries.map((e) => repo.upsertPricingConfig(e.plan, e.billingPeriod, e.amount, adminId)),
|
||||
)
|
||||
await repo.createAuditLog({
|
||||
adminUserId: adminId,
|
||||
action: 'UPDATE',
|
||||
resource: 'PricingConfig',
|
||||
after: toAuditJson(results),
|
||||
ipAddress: ip,
|
||||
userAgent: undefined,
|
||||
})
|
||||
return results
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user