Skip to content

feat(trip): edit trip title and notes - #39

Merged
KALalev18 merged 3 commits into
mainfrom
feat/trip-edit
Nov 1, 2026
Merged

KALalev18 merged 3 commits into
mainfrom
feat/trip-edit

Conversation

@KALalev18

@KALalev18 KALalev18 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #23 . Saving runs on the mock until PATCH /api/trips/{id} lands with backend #46 (@kctong529 's next backend PR); switching over means adding updateTrip to LIVE in client.ts.

Suggested new body:

Summary

Implement trip title and private-notes editing, including authenticated persistence through the backend API.

Closes #23 when the remaining integration acceptance criteria are satisfied.

Implementation

  • Provide editable trip details with validation, Save/Cancel, keyboard interaction, and retry after failed saves.
  • Integrate updateTrip with authenticated PATCH /api/trips/{id} when the persistent API is configured.
  • Preserve mock editing behavior for standalone frontend development and acceptance tests.
  • Refresh the Trip view and Dashboard after successful updates.

Backend integration

Live editing has been verified against the PostgreSQL-backed, owner-authorized PATCH endpoint submitted in backend PR #48. Tests cover persistence, input validation, and cross-account ownership isolation.

Persistent backend availability is required before releasing this functionality. Unicode code-point length alignment is tracked separately in frontend #42.

Dependencies and merge order

This PR builds on frontend #38. Merge #38 first, then retarget this PR to main and verify the final diff and CI checks.

Sharing and photo ordering are separate follow-up PRs (#37 and #40).

@KALalev18 KALalev18 self-assigned this Oct 28, 2026
@kctong529 kctong529 moved this from Backlog to In review in MapMory Project Board Oct 30, 2026
@kctong529
kctong529 changed the base branch from main to feat/api-adapters October 31, 2026 02:00
@kctong529

Copy link
Copy Markdown
Contributor

I've rebased the trip-editing work onto PR #38's API adapter branch so we can continue integration without waiting for #38 to merge.

The original trip-editing commit (6f4d6ec) has been replayed as 6f5ab73. During integration, I resolved the overlapping mock API changes and updated mockUpdateTrip() to return a TripDetail through the existing toTripDetail() adapter, keeping the implementation consistent with PR #38's API boundary.

The PR now targets feat/api-adapters and contains only the trip-editing changes.

Next, I'll enable live PATCH against backend #46 and add persistent integration tests. The existing mock editing tests will remain in place.

Once PR #38 merges, we can retarget this PR to main.

@kctong529

Copy link
Copy Markdown
Contributor

I noticed that mockUpdateTrip() checks the notes length before trimming, while the backend validates the normalized value. This means the mock could reject an update that the backend would accept.

I suggest trimming the notes before checking their length, so the mock and persistent implementations behave consistently.

@kctong529

Copy link
Copy Markdown
Contributor

There's a small difference between the frontend and backend character limits. The Go backend counts Unicode code points, while JavaScript .length and HTML maxLength count UTF-16 code units. As a result, some titles or notes containing emoji could be rejected by the frontend even though the backend would accept them.

I suggest aligning the frontend validation with the backend's counting rules. Since this also affects trip creation, we could address it in a separate issue #42 rather than expanding the scope of this PR.

@kctong529 kctong529 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've integrated this branch with the API adapters from #38 and enabled persistent trip updates through the backend PATCH endpoint.

The live integration tests now cover partial updates, notes clearing, validation, authentication, and cross-account ownership isolation. All 7 integration tests passed, alongside 263 acceptance tests (2 skipped), 2 boundary tests, type checks, and the production build.

I also verified editing through the browser: the updated title and notes persisted after signing out, signing back in, and restarting the backend.

The backend changes will be submitted separately under backend #46.

Before merging this PR, please merge #38 first, then change this PR's base branch from feat/api-adapters to main. After retargeting, please verify that the diff contains only the trip-editing changes and that all checks still pass.

We should also ensure that backend #46 is merged and deployed before releasing this frontend change, since the editing workflow depends on the new PATCH endpoint.

@kanetran29 kanetran29 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from feat/api-adapters to main November 1, 2026 21:02
KALalev18 and others added 3 commits November 1, 2026 23:02
- Enable authenticated PATCH requests for trip updates in live mode
- Reuse the existing HTTP client and trip response adapter
- Preserve mock editing when backend integration is disabled
- Cover partial title and notes updates against the live backend
- Verify notes clearing, response adaptation, and persisted values
- Test invalid PATCH requests without modifying stored records
- Check authentication and nonexistent-trip error responses
- Verify bidirectional PATCH isolation between Firebase users
@KALalev18
KALalev18 merged commit 0cd964b into main Nov 1, 2026
2 checks passed
@KALalev18
KALalev18 deleted the feat/trip-edit branch November 1, 2026 21:08
@github-project-automation github-project-automation Bot moved this from In review to Done in MapMory Project Board Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add trip title and notes editing

3 participants