Repository navigation
feat(projects): per-user favourite projects - #432
Merged
Merged
Conversation
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.
|
Warning Review limit reachedYou'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. View limit details
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. Comment |
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:idroute.PUT /projects/:id/favorite→204, idempotent. Unknown project →404.DELETE /projects/:id/favorite→204, idempotent; also204for an unknown project (disconnect is a no-op).GET /projects, noRoleGuard: every role may use them, guests included.:idgoes throughParseUUIDPipe, so a non-UUID is400.Database
Implicit many-to-many
User.favoriteProjects↔Project.favoritedBy("UserFavoriteProjects"). Migration20261024134632_user_favorite_projects, generated byprisma migrate dev: one join table, both foreign keysON DELETE CASCADE, so deleting a project or a user drops its favourites. No existing table changes.How it was checked
test/project-favorites.e2e-spec.tsagainst a real database: 401 without a token, add/remove for admin, editor and guest, idempotency, per-user isolation, cleanup on project and user deletion.npm run typecheck,npm run lint(0 errors),npm run format:check,npm run test:cov1045 tests above the thresholds,npm run test:e2e262 tests (on a separate database, so the shared dev DB has no unknown migration).