Skip to content

Feature/note downloading - #47

Merged
p1an0guy merged 3 commits into
mainfrom
feature/note-downloading
Jan 29, 2026
Merged

p1an0guy merged 3 commits into
mainfrom
feature/note-downloading

Conversation

@carter-a-lim

Copy link
Copy Markdown
Collaborator

Linked Issues

Closes #27 #35

Summary

Adds signed URL generation for previews and downloads, plus a dashboard download button that uses the new /api/notes/[id]/download route and deducts credits from profiles.credit_score

  1. storage.ts: Creates a server-only helper that makes Supabase signed URLs with a default 1‑hour TTL
  2. ~/notes/route.ts: When listing notes, it now turns preview file keys into signed preview URLs
  3. ~/download/route.ts: New endpoint that checks login, charges credits (from profiles.credit_score), records the download, then streams the file (best way i could find to make it so only authenticated user can download)
  4. page.tsx: Adds a “Download” button per note card that calls the download API and saves the file locally
  5. dashboard.css: Styles the new download button
  6. storage.md: Documents signed URL usage for previews and that downloads are streamed via the API

How to Test

Sign in and open /dashboard
Click “Download” on a note card; confirm the file opens and credits decrease
Verify preview thumbnails still load in the notes list

Checklist

  • Tests added/updated
  • Lint/tests pass locally
  • Docs updated (README/ADR/changelog)

@p1an0guy
p1an0guy merged commit 604013f into main Jan 29, 2026
1 check passed
@p1an0guy
p1an0guy deleted the feature/note-downloading branch January 29, 2026 03:32
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.

Note Downloading (backend functionality)

2 participants