feat: edit print templates on the printer page and store them on presets

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-03 22:45:56 -04:00
co-authored by Cursor
parent 1337d9833d
commit c03ffc0833
18 changed files with 904 additions and 293 deletions
+2 -4
View File
@@ -19,7 +19,6 @@ public class PrintPresetService : IPrintPresetService
{
return await _context.PrintPresets
.AsNoTracking()
.Include(p => p.Note)
.OrderBy(p => p.Name)
.ToListAsync(cancellationToken);
}
@@ -28,7 +27,6 @@ public class PrintPresetService : IPrintPresetService
{
return await _context.PrintPresets
.AsNoTracking()
.Include(p => p.Note)
.FirstOrDefaultAsync(p => p.Id == id, cancellationToken);
}
@@ -48,7 +46,7 @@ public class PrintPresetService : IPrintPresetService
{
preset.Name = preset.Name.Trim();
preset.UpdatedAt = DateTime.UtcNow;
preset.Note = null!;
preset.TemplateMarkdown ??= string.Empty;
if (await NameExistsAsync(preset.Name, null, cancellationToken))
throw new InvalidOperationException($"A print preset named '{preset.Name}' already exists.");
@@ -72,7 +70,7 @@ public class PrintPresetService : IPrintPresetService
throw new InvalidOperationException($"A print preset named '{name}' already exists.");
existing.Name = name;
existing.NoteId = preset.NoteId;
existing.TemplateMarkdown = preset.TemplateMarkdown ?? string.Empty;
existing.EntityType = preset.EntityType;
existing.FiltersJson = preset.FiltersJson;
existing.UpdatedAt = DateTime.UtcNow;