Skip to content

[Backend]: Persist chat-generated itineraries to trips tables #37

@Hanseooo

Description

@Hanseooo

Priority Area Type

Problem

Generated itineraries are returned to the frontend but are not persisted as durable trip records. Users cannot reliably find generated plans in trips pages after chat completion.

Context

  • Reference: docs/FUTURE_ISSUES_BACKLOG.md
  • Related code: backend/app/services/chat_service.py, backend/app/repositories/trip_repo.py, backend/app/models/trip.py

Requirements

  • Persist generated itinerary output into Trip, TripDay, and Activity tables.
  • Link persisted records to authenticated user context when available.
  • Return persisted identifiers/metadata needed by frontend navigation (for example trip_id).
  • Ensure failure paths do not leave partial or inconsistent records.

Acceptance Criteria

  • Chat itinerary generation creates DB records successfully.
  • New trip appears in trips list after generation.
  • Each day and activity is stored and linked correctly to the trip.
  • On write failure, API returns clear error and rolls back partial writes.
  • Tests cover successful persistence and failure behavior.

Dependencies

  • Enables: frontend data wiring issue.

Out of Scope

  • Redis session durability
  • Observability/rate-limiting hardening

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions