Skip to content

[BHO-96]: add useUploadFlow and upload API stubs - #106

Merged
naman0r merged 2 commits into
mainfrom
naman-96
Nov 22, 2026
Merged

naman0r merged 2 commits into
mainfrom
naman-96

Conversation

@naman0r

@naman0r naman0r commented Nov 22, 2026 •

Copy link
Copy Markdown

ℹ️ Issue

Closes #96

📝 Description

Adds useUploadFlow, the hook behind the Today's Entry upload. It gets an upload URL, sends the file to S3, then fetches a preview of what the file would change. The API calls are stubs that return mock data for now.

  • api/imports.ts has requestUploadUrl, uploadToPresignedUrl and previewImport, with their real signatures.
  • api/types.ts has the upload URL and preview response types.
  • api/mocks/preview.ts has a valid preview and one with row errors.
  • hooks/useUploadFlow.ts takes the upload kind (daily or historical) and returns status, progress, error, preview, s3Key, fileName, upload and reset. The status is idle, uploading, previewing, ready, invalid (the file has bad rows) or error.

The UploadView connects it to the UploadFile component like this:

const { progress, upload, reset } = useUploadFlow('daily');
<UploadFile progress={progress} onSubmit={upload} onCancel={reset} />

✔️ Verification

nx run frontend:test
nx run frontend:typecheck

The tests cover a full upload, a preview with row errors, a failed step, and cancelling mid-upload.

🏕️ (Optional) Future Work / Notes

@naman0r
naman0r requested a review from Rayna-Yu as a code owner November 22, 2026 20:43
@github-actions
github-actions Bot requested a review from cheangie November 22, 2026 20:44
github-actions Bot added a commit that referenced this pull request Nov 22, 2026

@cheangie cheangie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lgtm

@Rayna-Yu Rayna-Yu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me!

github-actions Bot added a commit that referenced this pull request Nov 22, 2026
@naman0r
naman0r merged commit b140829 into main Nov 22, 2026
6 checks passed
github-actions Bot added a commit that referenced this pull request Nov 22, 2026
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.

Dev: Today's Entry UploadView hooks

3 participants