Bookmarks: let people save posts privately

Aperta
#120 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
express, mongodb, nodejs, react, typescript
Ambito
api, full-stack

Direzione di ricerca

Start with apps/api/src/models/Like.ts as the template for the new Bookmark model, then read apps/api/src/controllers/postController.ts to see how likedSet fills likedByMe. The web side is useToggleLike and patchPost in apps/web/src/hooks/usePosts.ts, with the button in PostCard.tsx. Done means the PUT/DELETE toggle is idempotent, the list hides deleted and banned-author posts, a test shows one user cannot read another's bookmarks, and typecheck and lint pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

api enhancement help wanted web

Difficulty: Intermediate · Estimated size: 1 to 2 days

Context

People can like and comment on posts, but there is no private way to keep a post to read or use later.

Problem or goal

Add bookmarks. A bookmark is private: only the person who saved it can see it, and the post's author is never told.

Suggested approach

  • API: a Bookmark model (user, post, createdAt) with a unique index on user + post, and a TTL-free index on user + _id for paging.
  • API: PUT /api/posts/:id/bookmark and DELETE /api/posts/:id/bookmark (idempotent, so saving twice is not an error) and GET /api/bookmarks with the same cursor paging as the feeds.
  • Shared: add bookmarkedByMe: boolean to PostDTO and fill it the way likedByMe is filled.
  • Web: a bookmark icon button on the post card (with aria-pressed), a /bookmarks page linked from the left menu, and an empty state.
  • Docs: add a row to docs/LIMITS.md if you add a rate limit.

Where to look

  • apps/api/src/models/Like.ts (a good template)
  • apps/api/src/controllers/postController.ts (likes and likedSet)
  • apps/web/src/hooks/usePosts.ts (useToggleLike and patchPost)
  • apps/web/src/components/PostCard.tsx

Acceptance criteria

  • Saving and unsaving works, survives a refresh and updates every list that shows the post.
  • Deleted posts and posts by banned authors do not appear in the list.
  • Another person can never read your bookmarks (add a test).
  • Paid posts stay locked in the list until bought.
  • New API tests and no typecheck or lint errors.

Out of scope

Folders or collections of bookmarks.

How to work on it

  1. Comment here to claim it, so two people do not do the same work.
  2. Fork the repo and branch from main (feat/short-name or fix/short-name). Setup steps are in docs/DEVELOPMENT.md.
  3. Keep the change focused and add tests for backend logic.
  4. Run npm run typecheck, npm test and npm run lint and npm run format before opening the pull request.
  5. Use a Conventional Commits title (for example feat(web): add bookmarks). More in CONTRIBUTING.md.

Stuck? Ask in this issue. Questions are welcome.


Generated by Claude Code

Lingua principale
TypeScript
Stelle
6
Fork
6
Merge medio
1h 59m
PR unite (30g)
59

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Haseeb-MernStack/commune

Tutte le issue di Haseeb-MernStack/commune

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.