journal/Journal.Core/Services/Entries/JournalEntryDtoMapper.cs
Jacob Schmidt 0465b05845 feat: add shutdown command, auth/entries backend, and editor panel
- Add Rust shutdown command that kills sidecar and exits app cleanly
- Frontend calls invoke('shutdown') after vault flush on close
- Add auth.ts, entries.ts, and normalize.ts backend modules
- Add EditorPanel.svelte component
- Expand entries store with full CRUD support
- Add JournalEntryDtos and JournalEntryDtoMapper in Journal.Core
- Update entry search, fragments, and sidecar CLI

Co-Authored-By: Oz <oz-agent@warp.dev>
2026-02-26 15:34:28 -06:00

33 lines
1.1 KiB
C#

using Journal.Core.Dtos;
using Journal.Core.Models;
namespace Journal.Core.Services.Entries;
internal static class JournalEntryDtoMapper
{
public static JournalEntryDto ToDto(this JournalEntry entry)
{
ArgumentNullException.ThrowIfNull(entry);
return new JournalEntryDto(
Date: entry.Date,
Fragments:
[
.. entry.Fragments.Select(fragment => new FragmentDto(
Id: fragment.Id,
Type: fragment.Type,
Description: fragment.Description,
Time: fragment.Time,
Tags: [.. fragment.Tags]))
],
RawContent: entry.RawContent,
Sections: entry.Sections.ToDictionary(
section => section.Key,
section => new ParsedSectionDto(
Title: section.Value.Title,
Content: [.. section.Value.Content],
Checkboxes: section.Value.Checkboxes.ToDictionary(checkbox => checkbox.Key, checkbox => checkbox.Value)),
StringComparer.Ordinal));
}
}