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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user