Pin one post to the top of your profile

Aperta
#125 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
66/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
express, mongodb, nodejs, react, typescript
Ambito
full-stack

Direzione di ricerca

Start with the User model in apps/api/src/models/User.ts and the user controller in apps/api/src/controllers/userController.ts, then read how GET /api/users/:username/posts builds its pages. Add the pinnedPost field and the PUT /api/users/me/pinned-post route, then show the pinned post first on page one only. Tests should cover refusing another user's post, clearing the pin on delete, and no duplicates. Done when the web label in PostCard.tsx and ProfilePage.tsx matches the API behaviour.

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

Descrizione

api enhancement help wanted web

Difficulty: Intermediate · Estimated size: 1 day

Context

The profile shows posts newest first. People often want to show their best or most important post first.

Problem or goal

Let a person pin one of their own posts. The pinned post shows first on their profile with a "Pinned" label.

Suggested approach

  • API: add pinnedPost (post id or null) to User; PUT /api/users/me/pinned-post with { postId } or null. Only the owner's own posts can be pinned.
  • Return it in the profile and make GET /api/users/:username/posts put it on the first page only, without repeating it later in the list.
  • Web: "Pin to profile" and "Unpin" in the post menu; a label on the card.

Where to look

  • apps/api/src/models/User.ts
  • apps/api/src/controllers/userController.ts
  • apps/web/src/pages/ProfilePage.tsx
  • apps/web/src/components/PostCard.tsx

Acceptance criteria

  • Pinning another person's post is refused.
  • Deleting the pinned post clears the pin.
  • The pinned post is not duplicated in the list.
  • Tests for all of the above.

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.