feat(board): add board sync list and bulk fetch by ids endpoints#466
Merged
Conversation
Add the backend needed for efficient diff-based board sync:
- GET /board/sync/{email}: lightweight { id, lastEdited } list so the
client can detect which boards changed.
- POST /board/byids: returns full boards for a set of ids, letting the
client fetch only changed boards in one request instead of N calls to
GET /board/{id}.
- Board model: index email and { email, lastEdited, _id } to back the
sync queries.
Security: both endpoints require a Bearer token and scope non-admin
callers to their own boards. /board/byids drops invalid ObjectIds and
caps the request at 3000 ids in the controller (swagger does not
validate array maxItems on bodies).
Adds controller tests for both endpoints.
Refs cboard-org/cboard#2213, cboard-org/cboard#2214
Closes #465
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
tomivm
approved these changes
Jun 5, 2026
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.
Summary
Adds the backend needed for efficient diff-based board sync, supporting the frontend work in cboard-org/cboard#2213 (PR cboard-org/cboard#2214).
Instead of fetching every board in full or calling
GET /board/{id}once per board (N round-trips), a client can now:GET /board/sync/{email}→ get a lightweight{ id, lastEdited }list of all the user's boards.POST /board/byidswith just the changed ids → fetch those full boards in a single request.Changes
GET /board/sync/{email}(getBoardsSync) — lightweight change list.POST /board/byids(getBoardsByIds) — bulk fetch full boards by id.Boardmodel — indexes onemailand{ email, lastEdited, _id }to back the sync queries.BoardsByIdsRequest,GetBoardsByIdsResponse).Security / safety
admin/userscopes).email.POST /board/byidsfilters out invalid ObjectIds and caps the request at 3000 ids, enforced in the controller — swagger does not validate arraymaxItemson request bodies, so the cap must live in code.Notes for reviewers
/board/byidsis declared in the swagger spec before/board/{id}so the literal path resolves ahead of the{id}template under swagger-tools routing. Keep that ordering.minItems/maxItemson bodies; size/shape constraints are validated in the controller.Test plan
npm test(board controller suite) — auth, admin-only access to other users' data, ObjectId filtering, size cap, non-admin isolation.Refs cboard-org/cboard#2213, cboard-org/cboard#2214
Closes #465