Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add /map endpoint to serve optimized Place data for Map Integration #558

Merged
merged 13 commits into from
Nov 5, 2024

Conversation

cyaiox
Copy link
Contributor

@cyaiox cyaiox commented Nov 4, 2024

This PR introduces a new /map endpoint that provides a streamlined dictionary of Place data, keyed by each Place's base_position. The endpoint returns a reduced set of Place information optimized for map fetching by the Explorer, enabling efficient data retrieval and integration.

Returned object:

{
  "total": 1,
  "ok": true,
  "data": {
    "1,1": {
      "id": "xyz-xyz-xyz",
      "base_position": "1,1",
      "title": "Test Title",
      "description": "Test Description",
      "image": "https://peer.decentraland.org/.../someImg",
      "contact_name": "Test",
      "categories": [
        "art",
        "poi"
      ],
      "user_favorite": false,
      "user_like": false,
      "user_dislike": false,
      "user_visits": 100,
      "user_count": 50
    },
  }
}

Closes: #551

Copy link

github-actions bot commented Nov 4, 2024

Pull Request Test Coverage Report for Build 11691435803

Details

  • 534 of 548 (97.45%) changed or added relevant lines in 8 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.01%) to 94.34%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/entities/Map/routes/getMapPlacesMostActive.ts 104 106 98.11%
src/entities/Map/utils.ts 42 45 93.33%
src/entities/RealmProvider/utils.ts 57 66 86.36%
Files with Coverage Reduction New Missed Lines %
src/entities/Place/utils.ts 2 80.38%
Totals Coverage Status
Change from base Build 11668253196: 0.01%
Covered Lines: 14446
Relevant Lines: 15160

💛 - Coveralls

@cyaiox cyaiox changed the title feat: Add map endpoint feat: Add /map endpoint to serve optimized Place data for Map Integration Nov 4, 2024
Copy link
Collaborator

@braianj braianj left a comment

Choose a reason for hiding this comment

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

Awesome work 🎉

Here are some short comments

Comment on lines 21 to 28
if (!stats) {
const statsPosition = (place.positions || []).find(
(position) => sceneStats[position]
)
if (statsPosition) {
stats = sceneStats[statsPosition]
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would you mind avoiding nest code?
Maybe something like

Suggested change
if (!stats) {
const statsPosition = (place.positions || []).find(
(position) => sceneStats[position]
)
if (statsPosition) {
stats = sceneStats[statsPosition]
}
}
let statsPosition
if (!stats) {
statsPosition = (place.positions || []).find(
(position) => sceneStats[position]
)
}
if (!stats && statsPosition) {
stats = sceneStats[statsPosition]
}

@cyaiox cyaiox requested a review from braianj November 5, 2024 16:04
@cyaiox cyaiox enabled auto-merge (squash) November 5, 2024 18:12
Copy link
Collaborator

@braianj braianj left a comment

Choose a reason for hiding this comment

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

Great work! 🎉

@cyaiox cyaiox merged commit 201581a into master Nov 5, 2024
2 checks passed
@cyaiox cyaiox deleted the feat/add-maps-endpoint branch November 5, 2024 19:58
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.

Create a New Endpoint to Fetch Reduced Version of Places
2 participants