namespace QuestionsApi.Services; // One-time sweep: flags every question that currently has at least one image so it can be // pulled from student rotation for review, without touching IsPublished. Idempotent (only // touches questions not already flagged, via QuestionStore.FlagAllWithMediaAsync's filter) - // safe to re-run. public static class FlagMediaQuestionsCommand { private const string Reason = "Bulk-flagged for image review"; private const string FlaggedBy = "system"; public static async Task RunAsync(IConfiguration configuration, TextWriter output) { var mongo = new MongoDatabaseProvider(configuration); var questions = new QuestionStore(mongo); var flagged = await questions.FlagAllWithMediaAsync(FlaggedBy, Reason); await output.WriteLineAsync($"Flagged {flagged} question(s) with images for review."); return 0; } }