Skip to content

Sayali: add user state indicator backend - controller, models, routes#2074

Open
sayali-2308 wants to merge 2 commits intodevelopmentfrom
Sayali_User_State_Indicator
Open

Sayali: add user state indicator backend - controller, models, routes#2074
sayali-2308 wants to merge 2 commits intodevelopmentfrom
Sayali_User_State_Indicator

Conversation

@sayali-2308
Copy link
Contributor

@sayali-2308 sayali-2308 commented Feb 26, 2026

image

Description

Implements #4 (Priority Urgent)

Related PRS (if any):

Backend PR related to Frontend PR OneCommunityGlobal/HighestGoodNetworkApp#4899

Main changes explained:

  • Created src/controllers/userStateController.js — handles catalog CRUD and user selection
  • Created src/models/userStateCatalog.js — catalog schema with key, label, color, order, isActive
  • Created src/models/userStateSelection.js — user selection schema with userId and stateIndicators
  • Created src/routes/userState.js — GET/POST/PUT/PATCH routes for catalog and selection
  • Updated src/startup/routes.js — registered /api/userstate routes
  • Seeded catalog with 5 default items

How to test:

  1. GET http://localhost:4500/api/userstate/catalog — should return 5 items
  2. GET http://localhost:4500/api/userstate/selection/:userId — should return empty array
  3. PUT http://localhost:4500/api/userstate/selection/:userId with selectedKeys array — should save
  4. PATCH http://localhost:4500/api/userstate/catalog/:key with isActive false — should hide item

Screenshots or videos of changes:

image image image image

Note:

Requires frontend PR OneCommunityGlobal/HighestGoodNetworkApp#4899 to be merged together

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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