feat: add highlight management for places in API and UI#790
Merged
AndresMorelos merged 5 commits intomasterfrom Feb 4, 2026
Merged
feat: add highlight management for places in API and UI#790AndresMorelos merged 5 commits intomasterfrom
AndresMorelos merged 5 commits intomasterfrom
Conversation
- Introduced a new admin-only endpoint `/places/{place_id}/highlight` to update the highlight status of places.
- Updated OpenAPI documentation to include the new highlight endpoint and its request/response schemas.
- Enhanced the Places service to support highlight status updates.
- Added navigation for admin users to manage highlighted places.
- Updated relevant components and schemas to reflect the new highlight feature.
Pull Request Test Coverage Report for Build 21673146172Warning: 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
💛 - Coveralls |
- Replaced the HeaderMenu wrapper with a div for improved layout consistency. - Maintained existing functionality of the search input and result count display.
LautaroPetaccio
approved these changes
Feb 2, 2026
Contributor
LautaroPetaccio
left a comment
There was a problem hiding this comment.
Great job! 👍 I've left a couple of comments to review.
src/pages/admin/highlights.tsx
Outdated
Comment on lines
+64
to
+74
| if (activeTab === "worlds") { | ||
| const worldsFetch = await Places.get().getWorlds(searchOptions) | ||
| response.data = worldsFetch.data | ||
| response.ok = worldsFetch.ok | ||
| response.total = worldsFetch.total | ||
| } else { | ||
| const placesFetch = await Places.get().getPlaces(searchOptions) | ||
| response.data = placesFetch.data | ||
| response.ok = placesFetch.ok | ||
| response.total = placesFetch.total | ||
| } |
Contributor
There was a problem hiding this comment.
WDYT about doing something like this?
Suggested change
| if (activeTab === "worlds") { | |
| const worldsFetch = await Places.get().getWorlds(searchOptions) | |
| response.data = worldsFetch.data | |
| response.ok = worldsFetch.ok | |
| response.total = worldsFetch.total | |
| } else { | |
| const placesFetch = await Places.get().getPlaces(searchOptions) | |
| response.data = placesFetch.data | |
| response.ok = placesFetch.ok | |
| response.total = placesFetch.total | |
| } | |
| const placesFetchFunction = activeTab === "worlds" ? Places.get().getWorlds : Places.get().getPlaces | |
| const response = await placesFetchFunction() |
| jest.clearAllMocks() | ||
| }) | ||
|
|
||
| describe("updateHighlight", () => { |
Contributor
There was a problem hiding this comment.
Just to be a bit more closer to our testing standards, would you mind renaming this context to a more semantical wise format?
Suggested change
| describe("updateHighlight", () => { | |
| describe("when updating the highlight status of a place", () => { |
| describe("updateHighlight", () => { | ||
| describe("when user is not authenticated", () => { | ||
| it("should throw unauthorized error", async () => { | ||
| mockWithAuth.mockRejectedValueOnce(new Error("Unauthorized")) |
Contributor
There was a problem hiding this comment.
Just to be a bit more closer to our testing standards, would you mind moving this mock into a beforeEach?
The same would apply to all other tests.
- Updated the test suite description for the `updateHighlight` function to clarify the context of the tests, specifically indicating that it pertains to updating the highlight status of a place.
- Consolidated the data fetching logic for worlds and places into a single function to reduce code duplication. - Improved readability by using a conditional function binding based on the active tab.
- Improved the organization of test cases for the `updateHighlight` function by consolidating repeated setup logic into `beforeEach` hooks. - Clarified the test flow for different user authentication scenarios, including unauthorized access and admin checks. - Streamlined the handling of mock responses to ensure consistency across tests.
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.
/places/{place_id}/highlightto update the highlight status of places.