- Wire up lists and todos to C# backend with full CRUD persistence - Add models, DTOs, repositories, and services for lists and todo lists/items - Preserve SQLite DB across vault rebuild/load cycles - Add session store for vault password persistence across navigation - Add inline name input for creating lists and todo lists in SidePanel - Clear editor panel on section change with empty state placeholder - Default markdown editor to preview mode on item selection - Decompose EditorPanel into sub-components: - editor/FragmentEditor, editor/TodoEditor, editor/MarkdownEditor - Shared markdown utilities in utils/markdown.ts - Strip verbose console/eprintln logging from frontend and Tauri backend - Add graceful shutdown with vault persistence on window close Co-Authored-By: Oz <oz-agent@warp.dev>
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
namespace Journal.Core.Models;
|
|
|
|
public class TodoItem
|
|
{
|
|
public Guid Id { get; }
|
|
public Guid ListId { get; }
|
|
public string Text { get; set; }
|
|
public bool Done { get; set; }
|
|
public int SortOrder { get; set; }
|
|
|
|
public TodoItem(Guid listId, string text, int sortOrder = 0)
|
|
{
|
|
Validate(text);
|
|
if (listId == Guid.Empty)
|
|
throw new ArgumentException("ListId is required", nameof(listId));
|
|
|
|
Id = Guid.NewGuid();
|
|
ListId = listId;
|
|
Text = text.Trim();
|
|
Done = false;
|
|
SortOrder = sortOrder;
|
|
}
|
|
|
|
public TodoItem(Guid id, Guid listId, string text, bool done, int sortOrder)
|
|
{
|
|
if (id == Guid.Empty)
|
|
throw new ArgumentException("Id is required", nameof(id));
|
|
if (listId == Guid.Empty)
|
|
throw new ArgumentException("ListId is required", nameof(listId));
|
|
Validate(text);
|
|
|
|
Id = id;
|
|
ListId = listId;
|
|
Text = text.Trim();
|
|
Done = done;
|
|
SortOrder = sortOrder;
|
|
}
|
|
|
|
private static void Validate(string text)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(text))
|
|
throw new ArgumentException("Text is required", nameof(text));
|
|
}
|
|
}
|