Add a review-flag state for questions, independent of publish status
Flagged questions disappear from every student-facing surface (search, exam simulation sampling, the missed-question review queue, bookmarks, direct fetch) while staying published - flagging and unpublishing are now separate, reversible actions with their own audit trail (who flagged it, when, why). Backend-only for now: SUPER-only flag/unflag/ list endpoints, no client UI. Includes a one-time CLI sweep (flag-media-questions) to flag every existing question with an image so they can be reviewed.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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<int> 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user