fix(backend): implement cursor-based pagination and fix PostGIS locat… - #227
Open
AryanYadav215 wants to merge 1 commit into
Open
fix(backend): implement cursor-based pagination and fix PostGIS locat…#227AryanYadav215 wants to merge 1 commit into
AryanYadav215 wants to merge 1 commit into
Conversation
…ion insertion in room.ts
|
@AryanYadav215 is attempting to deploy a commit to the Dharm3112's projects Team on Vercel. A member of the Team first needs to authorize it. |
👷 Deploy request for intellicircle pending review.Visit the deploys page to approve it
|
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.
Labels
ecosc'26, bug, backend
PR Description
Summary
This PR resolves Error #3 by introducing cursor-based pagination for the room history hydration endpoint and correcting a data structure bug that prevented proper PostGIS location insertions during room creation.
Type of Change
[x] 🐛 Bug fix (non-breaking change which fixes an issue)
[x] ✨ New feature (non-breaking change which adds functionality)
[ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] 📝 Documentation update
Changes Made
Cursor-Based Pagination (GET /:id/history):
Replaced the static query with dynamic drizzle-orm operators (lt(), and()).
Endpoint now accepts an optional cursor query parameter (using the message ID).
Calculates and returns a nextCursor in the response payload to allow the frontend to seamlessly infinite-scroll historical messages.
Spatial Geometry Fix (POST /):
Corrected the Drizzle insert payload. The locationPoint generated via ST_SetSRID(ST_MakePoint()) is now properly assigned to the location column, replacing the malformed { x: lng, y: lat } object that caused database insert failures.
How Has This Been Tested?
[x] Local fastify instance testing.
[x] Verified spatial point insertion in the PostGIS database.
[x] Validated that the /:id/history endpoint successfully returns subsequent batches of older messages when passing the cursor parameter.
Checklist
[x] My code follows the style guidelines of this project.
[x] I have performed a self-review of my own code.
[x] I have commented my code, particularly in hard-to-understand areas.
[x] My changes generate no new warnings or type errors.