Skip to content

feat(projects): per-user favourite projects - #432

Merged
pashidlos merged 2 commits into
masterfrom
feat/favorite-projects
Oct 24, 2026
Merged

pashidlos merged 2 commits into
masterfrom
feat/favorite-projects

Conversation

@pashidlos

Copy link
Copy Markdown
Member

What and why

The project list is getting favourites (frontend PR follows), so a user can pin the projects they work with instead of searching a long grid. Favourites are personal, so they live on the user, not in project settings.

Merge this before the frontend PR. The frontend works without these endpoints (it treats a 404 as "no favourites"), but starring needs them.

API

  • GET /projects/favorites → 200, the current user's favourite project ids (string[]). Declared before any :id route.
  • PUT /projects/:id/favorite → 204, idempotent. Unknown project → 404.
  • DELETE /projects/:id/favorite → 204, idempotent; also 204 for an unknown project (disconnect is a no-op).
  • JWT like GET /projects, no RoleGuard: every role may use them, guests included. :id goes through ParseUUIDPipe, so a non-UUID is 400.

Database

Implicit many-to-many User.favoriteProjects ↔ Project.favoritedBy ("UserFavoriteProjects"). Migration 20261024134632_user_favorite_projects, generated by prisma migrate dev: one join table, both foreign keys ON DELETE CASCADE, so deleting a project or a user drops its favourites. No existing table changes.

How it was checked

  • Unit specs first (service and controller, including HTTP-level cases: the favorites route is not shadowed, 204 with an empty body, 404, 400).
  • New test/project-favorites.e2e-spec.ts against a real database: 401 without a token, add/remove for admin, editor and guest, idempotency, per-user isolation, cleanup on project and user deletion.
  • After merging current master: npm run typecheck, npm run lint (0 errors), npm run format:check, npm run test:cov 1045 tests above the thresholds, npm run test:e2e 262 tests (on a separate database, so the shared dev DB has no unknown migration).

Users can mark projects as favourites so the project list can pin them.
Favourites are personal, so every signed-in role may use them, guests
included.

- GET /projects/favorites: ids of the current user's favourite projects
- PUT /projects/:id/favorite: 204, idempotent; 404 for an unknown project
- DELETE /projects/:id/favorite: 204, idempotent, also for an unknown project

Stored as an implicit many-to-many between User and Project; the join
table cascades, so deleting a project or a user drops its favourites.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 4b765d4 and b3eebfa.

Files selected for processing: 7
  • prisma/migrations/20261024134632_user_favorite_projects/migration.sql
  • prisma/schema.prisma
  • src/projects/projects.controller.spec.ts
  • src/projects/projects.controller.ts
  • src/projects/projects.service.spec.ts
  • src/projects/projects.service.ts
  • test/project-favorites.e2e-spec.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pashidlos
pashidlos merged commit abbd3bc into master Oct 24, 2026
11 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.

1 participant