Skip to content

feat: Generalize user preferences as per resource kind #793

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

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

shivani170
Copy link
Contributor

@shivani170 shivani170 commented Jun 19, 2025

Description

Context switcher implementation for

  • SDH

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@shivani170 shivani170 self-assigned this Jun 24, 2025
export const USER_PREFERENCES_ATTRIBUTE_KEY = 'userPreferences'

export const PreferredResourceKinds: PreferredResourceKindType[] = [
Copy link
Member

@AbhishekA1509 AbhishekA1509 Jun 25, 2025

Choose a reason for hiding this comment

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

Pls move to UPPER_CASE and can we make object since that will be type safe if new type is added

const parsedResourcesMap: UserPreferencesType['resources'] = {}

PreferredResourceKinds.forEach((resourceKind) => {
parsedResourcesMap[resourceKind] = resources?.[resourceKind]
Copy link
Member

Choose a reason for hiding this comment

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

Pls add fallback

}
}

/**
* @description This function updates the user preferences in the server. It constructs a payload with the updated user preferences and sends a PATCH request to the server. If the request is successful, it returns true. If an error occurs, it shows an error message and returns false.
* @param updatedUserPreferences - The updated user preferences to be sent to the server.
Copy link
Member

Choose a reason for hiding this comment

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

Pls fix the comment

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