Skip to content

fix(backend): implement cursor-based pagination and fix PostGIS locat… - #227

Open
AryanYadav215 wants to merge 1 commit into
Dharm3112:mainfrom
AryanYadav215:fix/room-history-pagination
Open

fix(backend): implement cursor-based pagination and fix PostGIS locat…#227
AryanYadav215 wants to merge 1 commit into
Dharm3112:mainfrom
AryanYadav215:fix/room-history-pagination

Conversation

@AryanYadav215

Copy link
Copy Markdown

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.

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

@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.

@netlify

netlify Bot commented Jul 28, 2026

Copy link
Copy Markdown

👷 Deploy request for intellicircle pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 053d9ab

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