Skip to content

feat: add highlight management for places in API and UI#790

Merged
AndresMorelos merged 5 commits intomasterfrom
feat/re-discovery-add-admin-page-for-highlight
Feb 4, 2026
Merged

feat: add highlight management for places in API and UI#790
AndresMorelos merged 5 commits intomasterfrom
feat/re-discovery-add-admin-page-for-highlight

Conversation

@AndresMorelos
Copy link
Contributor

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

- 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.
@github-actions
Copy link

github-actions bot commented Jan 30, 2026

Pull Request Test Coverage Report for Build 21673146172

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

  • 72 of 72 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 91.477%

Totals Coverage Status
Change from base Build 21484357934: 0.04%
Covered Lines: 14887
Relevant Lines: 16028

💛 - Coveralls

- Replaced the HeaderMenu wrapper with a div for improved layout consistency.
- Maintained existing functionality of the search input and result count display.
Copy link
Contributor

@LautaroPetaccio LautaroPetaccio left a comment

Choose a reason for hiding this comment

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

Great job! 👍 I've left a couple of comments to review.

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
}
Copy link
Contributor

Choose a reason for hiding this comment

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

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", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

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"))
Copy link
Contributor

Choose a reason for hiding this comment

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

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.
@AndresMorelos AndresMorelos merged commit eff781b into master Feb 4, 2026
3 checks passed
@AndresMorelos AndresMorelos deleted the feat/re-discovery-add-admin-page-for-highlight branch February 4, 2026 13:47
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