import { BaseCommand, flags } from '@adonisjs/core/ace' import { CommandOptions } from '@adonisjs/core/types/ace' import ReleaseMergeService from '#services/ReleaseMergeService' /** Merges uploads split per poster (gc:scheduler also does this every sweep). */ export default class ReleaseMergeSplit extends BaseCommand { public static commandName = 'release:merge-split' public static description = 'Merges releases of one upload that was posted under a different poster per file.' public static options: CommandOptions = { startApp: true, } @flags.boolean({ description: 'Only count them' }) declare dryRun: boolean public async run() { const { names, releases } = await ReleaseMergeService.mergeSplitPosts({ dryRun: this.dryRun }) this.logger.info(`${names} split uploads; ${releases} releases ${this.dryRun ? 'would be' : ''} merged into their first.`) } }