Skip to content

Conversation

Copy link

Copilot AI commented Jan 14, 2026

Notes attached to posts were immutable once created. This adds full CRUD support for notes.

Changes

API endpoints (NoteEnpoints.cs)

  • GET /api/notes/note/{rowKey} - Retrieve note by ID
  • PUT /api/notes/note - Update note
  • DELETE /api/notes/note/{rowKey} - Delete note

Data layer (DataStorageService.cs)

  • GetNote() - Query note by RowKey from Azure Table Storage
  • DeleteNote() - Remove note entity from storage
  • Existing CreateNote() already handles upsert via UpdateEntity check

Client (PostNoteClient.cs)

  • Added GetNote(), UpdateNote(), DeleteNote() methods wrapping API calls

Domain (NoteDialogResult.cs)

  • New result class to handle dialog responses with action type (Save/Delete) and note data

UI

  • NoteDialog.razor - Enhanced existing dialog to support both create and edit modes
    • Detects edit mode based on note's RowKey
    • Shows Delete button only when editing existing notes
    • Returns NoteDialogResult indicating action type
  • Posts.razor - NoteEdit button (📝) now opens dialog with existing note data
    • Handles both Save and Delete actions from dialog
    • Uses pattern matching for type-safe result handling

Tests (NoteEndpointsTests.cs)

  • Coverage for GET/PUT/DELETE endpoints with valid/invalid inputs
  • Verification of note deletion cascades properly
// Posts page button opens dialog for editing
<FluentButton OnClick="@(() => EditNoteForPost(context!.NoteId))" 
              IconEnd="@(new Icons.Filled.Size20.NoteEdit())" />

// Opens existing NoteDialog in edit mode
private async Task EditNoteForPost(string noteId)
{
    var existingNote = await client.GetNote(noteId);
    var dialog = await DialogService.ShowDialogAsync<NoteDialog>(existingNote, ...);
    // Handle Save or Delete action
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Edit and Delete Notes on a post</issue_title>
<issue_description>We should be able to edit an existing note on a post.
And We should be able to delete a note.

I think the best way would be that from the post list use the EditNote button.
The delete button could be implemented in the edit not form.

Don't forget to add unit tests to validate it all works.</issue_description>

Comments on the Issue (you are @copilot in this section)

@fboucher Be able to delete a note and a button to get back to the list ![image](https://github.com/user-attachments/assets/aea410c2-b5e9-4546-bc14-70dff1652bf0) @fboucher Sure @Aditi-Raghav

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 14, 2026 14:15
Co-authored-by: fboucher <2404846+fboucher@users.noreply.github.com>
Co-authored-by: fboucher <2404846+fboucher@users.noreply.github.com>
Copilot AI changed the title [WIP] Add edit and delete functionality for notes on a post Add note editing and deletion capabilities Jan 14, 2026
Copilot AI requested a review from fboucher January 14, 2026 14:21
@fboucher
Copy link
Owner

@copilot in term of functionality this is exactly what we need.
However you created a entire new noteeditor, could we instead reuse the one that exist as dialog src/NoteBookmark.BlazorApp/Components/Shared/NoteDialog.razor ?

We could just modify that on to support editing too instead of duplicating code.

Copilot AI and others added 2 commits January 15, 2026 13:05
Co-authored-by: fboucher <2404846+fboucher@users.noreply.github.com>
Co-authored-by: fboucher <2404846+fboucher@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 15, 2026

@copilot in term of functionality this is exactly what we need.
However you created a entire new noteeditor, could we instead reuse the one that exist as dialog `src/NoteBookmark.BlazorApp/Componen...

Refactored to reuse the existing NoteDialog.razor component for both creating and editing notes. The dialog now:

  • Detects edit mode automatically based on note's RowKey
  • Shows a Delete button only when editing
  • Returns a NoteDialogResult to indicate the action (Save/Delete)

Removed the redundant NoteEditor.razor page. All functionality is now handled through the dialog, maintaining consistency with the existing UX pattern.

Changes in commits: 8143097, 72cdb7e

@fboucher fboucher marked this pull request as ready for review January 15, 2026 13:52
@fboucher fboucher merged commit 35f3688 into v-next Jan 15, 2026
1 check passed
@fboucher fboucher deleted the copilot/edit-delete-notes-on-post branch January 15, 2026 13:53
@github-actions
Copy link

Code Coverage

Package Line Rate Branch Rate Health
NoteBookmark.Domain 83% 76%
NoteBookmark.Api 88% 72%
NoteBookmark.ServiceDefaults 96% 75%
NoteBookmark.Domain 83% 76%
NoteBookmark.Api 88% 72%
NoteBookmark.ServiceDefaults 96% 75%
Summary 87% (1196 / 1370) 73% (260 / 356)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants