Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

925 B
Raw Blame
import { FastifyPluginAsyncZod } from 'fastify-type-provider-zod'
import { SystemJobName } from '../../helper/system-jobs/common'
import { systemJobHandlers } from '../../helper/system-jobs/job-handlers'
import { systemJobsSchedule } from '../../helper/system-jobs/system-job'
import { licenseKeyUsageReportService } from './license-key-usage-report-service'

export const licenseKeyUsageReportModule: FastifyPluginAsyncZod = async (app) => {
    systemJobHandlers.registerJobHandler(SystemJobName.BILLING_USAGE_REPORT, async () => {
        await licenseKeyUsageReportService(app.log).reportAllPlatforms()
    })

    await systemJobsSchedule(app.log).upsertJob({
        job: {
            name: SystemJobName.BILLING_USAGE_REPORT,
            data: {},
            jobId: SystemJobName.BILLING_USAGE_REPORT,
        },
        schedule: {
            type: 'repeated',
            cron: '30 15 * * *',
        },
    })
}