Skip to content

feat: add ranking update endpoint for places#791

Merged
AndresMorelos merged 8 commits intomasterfrom
feat/re-discovery-add-ranking-endpoint
Feb 5, 2026
Merged

feat: add ranking update endpoint for places#791
AndresMorelos merged 8 commits intomasterfrom
feat/re-discovery-add-ranking-endpoint

Conversation

@AndresMorelos
Copy link
Contributor

  • Introduced a new API endpoint /places/{place_id}/ranking to update the ranking score of a place, requiring service token authentication.
  • Updated OpenAPI documentation to include details about the new endpoint, its authentication requirements, and use cases.
  • Added corresponding schemas and types for the ranking update request and response.
  • Integrated the new ranking update functionality into the existing routes for places.

- Introduced a new API endpoint `/places/{place_id}/ranking` to update the ranking score of a place, requiring service token authentication.
- Updated OpenAPI documentation to include details about the new endpoint, its authentication requirements, and use cases.
- Added corresponding schemas and types for the ranking update request and response.
- Integrated the new ranking update functionality into the existing routes for places.
@github-actions
Copy link

github-actions bot commented Feb 2, 2026

Pull Request Test Coverage Report for Build 21713120103

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 69 of 75 (92.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 91.516%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/api/CommsGatekeeper.ts 0 6 0.0%
Totals Coverage Status
Change from base Build 21673904663: 0.04%
Covered Lines: 14956
Relevant Lines: 16097

💛 - Coveralls

- Added a new middleware `withServiceAuth` to validate service-to-service authentication using a pre-configured token.
- Refactored the `updateRanking` endpoint to utilize the new middleware for authentication.
- Created unit tests for the middleware to ensure proper validation of authorization tokens and error handling.
@@ -0,0 +1,82 @@
import Context from "decentraland-gatsby/dist/entities/Route/wkc/context/Context"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that we already had this one https://github.com/decentraland/decentraland-gatsby/blob/master/src/entities/Auth/routes/withBearerToken.ts

Would you mind using it? 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

…dd-ranking-endpoint' into feat/re-discovery-add-ranking-endpoint
- Changed error messages for missing or invalid authorization tokens to be more descriptive.
- Replaced the `withServiceAuth` middleware with `withBearerToken` for improved token validation.
- Removed outdated tests related to the previous authorization method.
- Modified the `withBearerToken` call to include an `optional: false` parameter, ensuring that the token is required for authorization.
Copy link
Contributor

@kevinszuchet kevinszuchet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

- Replaced destructured AbortController usage with a direct instance to enhance clarity.
- Updated the abort logic to use the controller instance for better readability and maintainability.
@AndresMorelos AndresMorelos merged commit 209f578 into master Feb 5, 2026
3 checks passed
@AndresMorelos AndresMorelos deleted the feat/re-discovery-add-ranking-endpoint branch February 5, 2026 16:10
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.

2 participants