You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: Add UI and backend support so users can edit an existing Update record from the frontend (inline modal or dialog). Implement a backend edit endpoint, a small Pydantic schema for update payloads, a frontend API wrapper, and a lightweight edit UI that calls the API and updates local state.
Why: Currently the app only supports listing and creating Update entries. Making updates editable improves UX and enables corrections and small adjustments without DB/back-office intervention.
Scope
Backend: add PATCH/PUT endpoint and schema to edit Update.
DB: apply minimal changes if needed (optional updated_at column).
Frontend: add API method and a small UpdateEditDialog plus an 'Edit' control on each update card.
Tests: backend integration test; frontend unit test for API wrapper and component.
Permissions: reuse existing auth/permission checks used by create/delete endpoints.
DB changes (optional):
Add updated_at = Column(DateTime, default=func.now(), onupdate=func.now()) to Update model to track edits (optional but recommended).
Reuse existing CRUD utilities where possible. If crud.py contains a generic PUT handler, consider enabling or adapting it if that fits project conventions.
Frontend implementation notes
API client:
Add updateUpdate(updateId, payload) in api.ts. Use PATCH and return normalized ProjectUpdate.
UI:
Add a small UpdateEditDialog component that accepts initialText, onSave, onCancel.
Add an 'Edit' icon/button next to each update in ProjectCard.tsx. Clicking opens the dialog.
On save: call updateUpdate; on success update local state (replace updated item) or re-fetch via fetchUpdates(projectId).
UX choices:
Keep dialog minimal (textarea + Save/Cancel).
Use optimistic UI update or show a spinner while saving; either is acceptable for a first patch.
Types: extend types.ts ProjectUpdate if needed.
Testing
Backend: add an integration test that creates an Update, calls PATCH /api/updates/{id} to change text, asserts DB persisted change and response shape.
Frontend: add a unit test for updateUpdate API wrapper (mock fetch) and a component test for UpdateEditDialog that verifies onSave triggers API call and parent state update.
Acceptance criteria
User can click Edit on an Update, change text, save, and see updated content in the UI.
The backend returns updated resource and persists change.
Automated tests cover the new endpoint and client wrapper.
Implementation hints & low-risk approach
Implement backend endpoint first and test with curl/postman.
Add frontend API wrapper and a tiny dialog that calls the new endpoint.
Keep the UI change isolated to ProjectCard and a new UpdateEditDialog file to simplify review.
If adding updated_at, include a small migration (or add column as optional with default for new installs).
Summary: Add UI and backend support so users can edit an existing
Updaterecord from the frontend (inline modal or dialog). Implement a backend edit endpoint, a small Pydantic schema for update payloads, a frontend API wrapper, and a lightweight edit UI that calls the API and updates local state.Why: Currently the app only supports listing and creating
Updateentries. Making updates editable improves UX and enables corrections and small adjustments without DB/back-office intervention.Scope
Update.updated_atcolumn).UpdateEditDialogplus an 'Edit' control on each update card.Files to update
PATCH /updates/{update_id}(orPUT) handler.UpdateUpdateschema (fields optional:text?: str,task_id?: int).updated_atcolumn if desired.updateUpdate(updateId, payload)callingPATCH /api/updates/{id}.Backend implementation notes
UpdateUpdatePydantic model with optional fields (e.g.,text: Optional[str] = None,task_id: Optional[int] = None).updates.py:PATCH /updates/{update_id}(preferred for partial updates) orPUTfor full replacement.Updateby id, apply non-None fields, commit session, returnUpdateOut.updated_at = Column(DateTime, default=func.now(), onupdate=func.now())toUpdatemodel to track edits (optional but recommended).Frontend implementation notes
updateUpdate(updateId, payload)in api.ts. UsePATCHand return normalizedProjectUpdate.UpdateEditDialogcomponent that acceptsinitialText,onSave,onCancel.ProjectCard.tsx. Clicking opens the dialog.updateUpdate; on success update local state (replace updated item) or re-fetch viafetchUpdates(projectId).ProjectUpdateif needed.Testing
Update, callsPATCH /api/updates/{id}to changetext, asserts DB persisted change and response shape.updateUpdateAPI wrapper (mock fetch) and a component test forUpdateEditDialogthat verifiesonSavetriggers API call and parent state update.Acceptance criteria
Update, change text, save, and see updated content in the UI.Implementation hints & low-risk approach
ProjectCardand a newUpdateEditDialogfile to simplify review.updated_at, include a small migration (or add column as optional with default for new installs).