feat: implement debounced autosave with strict LocalStorage garbage collection (Stage 2 Task B)

This commit is contained in:
2026-06-11 20:33:59 +02:00
parent 155bfa9aa0
commit 978485e8ff
7 changed files with 592 additions and 21 deletions
@@ -21,6 +21,8 @@ namespace NexusReader.Application.Common;
[JsonSerializable(typeof(NexusReader.Application.DTOs.Media.ValidateChapterRequest))]
[JsonSerializable(typeof(NexusReader.Application.DTOs.Media.ValidateChapterResponse))]
[JsonSerializable(typeof(NexusReader.Application.DTOs.Media.UploadResultDto))]
[JsonSerializable(typeof(NexusReader.Application.DTOs.Media.LocalBackupEnvelope))]
[JsonSerializable(typeof(NexusReader.Application.DTOs.Media.AutosaveChapterRequest))]
public partial class AppJsonContext : JsonSerializerContext
{
}
@@ -16,3 +16,18 @@ public record ValidateChapterResponse(string SanitizedContent);
/// Response DTO containing the uploaded media file URL.
/// </summary>
public record UploadResultDto(string Url);
/// <summary>
/// Represents a structured JSON backup envelope stored in LocalStorage.
/// </summary>
public class LocalBackupEnvelope
{
public Guid ChapterId { get; set; }
public DateTime Timestamp { get; set; }
public string MarkdownContent { get; set; } = string.Empty;
}
/// <summary>
/// Request DTO for chapter autosaving.
/// </summary>
public record AutosaveChapterRequest(string MarkdownContent);