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

NOTIF_UPD-6: Implement Backend Logic for Update Management with Enhanced User Cache #252

Open
sebpalluel opened this issue Jan 18, 2024 · 0 comments

Comments

@sebpalluel
Copy link
Contributor

NOTIF_UPD-6: Implement Backend Logic for Update Management with Enhanced User Cache

Description

Develop next-updates-admin and next-updates-user libraries for managing user updates in the backend. Enhance next-updates-user with a local caching mechanism for efficient retrieval of updates, reducing frequent queries to the Redis cache.

next-updates-admin Library

Purpose

Manage the creation and deletion of updates for users from an administrative perspective.

Key Methods

  1. createUpdate:

    • Purpose: Create a new update for a user.
    • Parameters: accountId (UUID), updateType (enum), updateContent (JSONB).
    • Functionality: Validates the input and uses next-updates-cache to store the update in the cache.
    • Type Safety: Ensures that updateType and updateContent align with predefined types.
  2. deleteUpdate:

    • Purpose: Delete a specific update for a user.
    • Parameters: accountId (UUID), updateType (enum).
    • Functionality: Uses next-updates-cache to remove the specified update from the cache.
  3. deleteAllUpdatesForUser:

    • Purpose: Delete all updates associated with a specific user.
    • Parameters: accountId (UUID).
    • Functionality: Clears all updates for the given accountId from the cache.

Enhanced next-updates-user Library

Purpose

Enable users to retrieve their updates efficiently, using a local caching mechanism for optimized performance.

Enhanced Key Methods

  1. fetchAllUpdates:

    • Purpose: Retrieve all updates for the authenticated user and store them in a local cache.
    • Functionality: Uses the JWT from the user's cookie to determine accountId, fetches all updates using next-updates-cache, and stores them in the local cache.
    • Returns: A local cache object containing all updates for the user.
  2. getSpecificUpdate:

    • Purpose: Retrieve a specific type of update from the local cache.
    • Parameters: updateType (enum).
    • Functionality: Checks the local cache for the specified updateType and retrieves the relevant update if available.
    • Returns: The specific update object or null if not available.
  3. clearUpdate:

    • Purpose: Clear a specific update from the local cache and the Redis cache.
    • Parameters: updateType (enum).
    • Functionality: Clears the specified update from both the local cache and using next-updates-cache.
  4. clearAllUpdates:

    • Purpose: Clear all updates for the user from the local cache and the Redis cache.
    • Functionality: Clears all updates from both the local cache and using next-updates-cache.

Acceptance Criteria

  1. Effective Update Management: next-updates-admin efficiently handles creation and deletion of updates.
  2. Optimized User Retrieval: next-updates-user minimizes Redis cache queries by using a local caching mechanism.
  3. Type Safety and Validation: Input data is validated and conforms to predefined types and structures.
  4. Performance and Scalability: Both libraries perform well with a large volume of updates and users.
  5. Testing and Documentation: Comprehensive testing for reliability, along with detailed documentation on library usage.

Notes

  • Prioritize the security of user data in next-updates-user, implementing robust JWT-based authentication and authorization.
  • Ensure seamless integration with next-updates-cache for cache interactions.
  • The local caching mechanism in next-updates-user should be designed to handle synchronization issues with the Redis cache.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant