Skip to content

feat(upload): upload Guestline exports, daily or a backfill, and follow each file's job - #167

Merged
selvarajuv merged 3 commits into
mainfrom
upload-page
Nov 29, 2026
Merged

selvarajuv merged 3 commits into
mainfrom
upload-page

Conversation

@Jrodrigo06

@Jrodrigo06 Jrodrigo06 commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

What

The upload page at /upload, in the sidebar as "Upload data" (closes #148):

  • Drop Guestline exports, or pick them: the last few days for the daily upload, or a longer export to fill in past bookings. Each file is listed with its size before sending.
  • Files that aren't CSV, are over 50 MB, or go past 10 are turned away in the browser with a message.
  • Upload sends them to POST /hotels/{id}/ingest/files, then polls GET /jobs/{id} for each file: queued, running (rows saved so far), succeeded (the booking dates it covered, and new and updated rows) or failed with the job's error.
  • When every file loads: "Rates will update after the next retrain" and a link to the calendar. It never starts training.

Why

Managers upload a Guestline export every day and had no way to do it from the app (#148).

How to check

  • just frontend --mocks, open Upload data, drop a DailyNewReservations.csv: it goes queued, running, succeeded.
  • A file with "cancel" in its name gets the API's 422 from the mock; a .txt is turned away before sending.
  • Against a backend: a CSV that isn't Daily New Reservations comes back as "X is not a known report", and nothing is saved.

Screenshots

A .txt turned away in the browser; the CSV listed with its size

Upload page with one file ready and a rejected .txt

Running, with rows saved so far

Upload running

Finished, with the booking dates the file covered, the retrain message and a link to the calendar

Upload finished

A Cancellations file: the API's 422, and nothing uploaded

Wrong report rejected by the API

Notes

  • Backfills work the same way. The backend takes any date range and saves by booking reference, so overlapping uploads are safe: a booking already loaded is left as it is, or updated if it changed. Decision 0037 plans a two-year backfill first, then the last 7 days each day. A two-year export is about 55,000 rows, under the 50 MB limit.
  • Daily New Reservations only. refactor!: stop reading cancellations and drop the retired tables #163 removed Cancellations, so the page lists one report, although Build the daily PMS upload page #148 still names three.
  • No Figma design for this page. Built from Card, Button, Badge, ErrorState and PageHeader and the existing tokens.
  • Tested against jerome-dev with a real day's export (before refactor!: stop reading cancellations and drop the retired tables #163): both jobs succeeded with 0 new and 0 updated rows, since jerome-dev already had them. The test jobs were deleted afterwards. A retest today hit a Neon quota error on jerome-dev, so the screenshots use the mocks.
  • apiUpload is a separate function in client.js so the multipart request doesn't change apiPost.
  • "After the next retrain" depends on who starts retrains, an open question in docs/open-questions.md; nothing retrains on its own today.

The upload page needs to send the day's exports and follow each file's job; the mocks follow the same shapes so it works without the backend.
Managers upload the day's Guestline exports from the app and see whether each one loaded, without touching training.
…g dates

The backend takes any date range, and the first upload is a two-year backfill, so the page shouldn't read as daily only; the dates let a manager see a backfill reached back far enough.
@Jrodrigo06 Jrodrigo06 changed the title feat(upload): upload the day's Guestline export and follow each file's job feat(upload): upload Guestline exports, daily or a backfill, and follow each file's job Nov 27, 2026
@selvarajuv
selvarajuv merged commit 3158b27 into main Nov 29, 2026
4 checks passed
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.

Build the daily PMS upload page

2 participants