Jacob Schmidt 0d77300c22 feat: Project Journal backend monorepo
Monorepo with centralized build props, npm workspaces, LlamaSharp AI,
SQLite/SQLCipher storage, Svelte frontend, and unified smoke tests.

Co-Authored-By: Oz <oz-agent@warp.dev>
2026-03-02 20:56:26 -06:00

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));
}
}