PlotDirector/PlotLine/Controllers/PlotLineWorkspaceController.cs
Nick Beckley e48889ac05 Complete desktop workspaces, context menus and plot health
Commit the pending application, help and browser regression work. Pin the patched PKCS dependency for the production release.
2026-10-31 09:27:04 +00:00

47 lines
1.9 KiB
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using PlotLine.Services;
namespace PlotLine.Controllers;
[Authorize]
public sealed class PlotLineWorkspaceController(IPlotLineWorkspaceService workspace) : Controller
{
public async Task<IActionResult> Index(
int projectId,
int? bookId,
[FromQuery(Name = "plotLineId")] int[]? plotLineIds,
[FromQuery(Name = "threadId")] int[]? threadIds,
int? scenarioId,
bool showSuggestions = false)
{
var model = await workspace.GetAsync(projectId, bookId, plotLineIds, threadIds, scenarioId, showSuggestions, false);
return model is null ? NotFound() : Request.Headers["X-Plot-Map"] == "true" ? PartialView("_NarrativeMap", model) : View(model);
}
public async Task<IActionResult> Unattributed(int projectId, int? bookId, int? scenarioId)
{
var model = await workspace.GetAsync(projectId, bookId, [], [], scenarioId, false, true);
return model is null ? NotFound() : View("Index", model);
}
public async Task<IActionResult> Inspector(int projectId, int? bookId, int sceneId, int? scenarioId)
{
var model = await workspace.GetInspectorAsync(projectId, bookId, sceneId, scenarioId);
return model is null ? NotFound() : PartialView("_Inspector", model);
}
[HttpGet]
public async Task<IActionResult> Health(int projectId, int? bookId, int plotLineId, int? scenarioId)
{
var model = await workspace.GetAsync(projectId, bookId, [plotLineId], [], scenarioId, false, false);
return model is null || !model.SelectedPlotLineIDs.Contains(plotLineId) ? NotFound() : PartialView("_Health", model);
}
public async Task<IActionResult> Manuscript(int projectId, int? bookId, int sceneId)
{
var model = await workspace.GetManuscriptAsync(projectId, bookId, sceneId);
return model is null ? NotFound() : PartialView("_Manuscript", model);
}
}