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-2: Implement Notification Libraries for Admin and User Operations #248

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

Comments

@sebpalluel
Copy link
Contributor

NOTIF_UPD-2: Implement Notification Libraries for Admin and User Operations

Description

Develop two distinct libraries, notification-admin and notification-user, for handling notification-related operations in the Hasura environment. notification-admin will be responsible for creating and updating notifications with administrative rights, while notification-user will handle the retrieval and management of notifications from the user's perspective.

notification-admin Library

Purpose

Facilitate the creation and updating of notifications, ensuring type safety and alignment with the marketplaceNotification model in Hasura.

Key Methods

  1. createNotification:

    • Parameters: receiverId (UUID), senderId (text), type (enum), content (JSONB, optional).
    • Functionality: Validates input, ensures type safety based on the notification type, and creates a new notification in the database.
    • Returns: Confirmation of creation or error details.
  2. updateNotification:

    • Parameters: notificationId (UUID), updates (object containing updateable fields).
    • Functionality: Validates the provided updates, applies them to the specified notification, handles special cases like marking a notification's action as completed.
    • Returns: Updated notification data or error details.

notification-user Library

Purpose

Enable users to retrieve and interact with their notifications, ensuring data security and user-specific access.

Key Methods

  1. fetchNotifications:

    • Parameters: userId (UUID), page (int), limit (int).
    • Functionality: Retrieves a paginated list of notifications for the specified user, sorted by creation date.
    • Returns: Paginated list of notifications.
  2. resolveNotificationContent:

    • Parameters: notification (object).
    • Functionality: Constructs the metadata for the notification, applies i18n as necessary, and resolves any data related to CTAs.
    • Returns: Notification with resolved content.
  3. markNotificationAsRead:

    • Parameters: userId (UUID), notificationId (UUID).
    • Functionality: Marks the specified notification as read for the given user.
    • Returns: Confirmation of the update or error details.

Acceptance Criteria

  1. Functionality of notification-admin:

    • Can create and update notifications efficiently and securely.
    • Enforces type safety and aligns with the database schema.
  2. Functionality of notification-user:

    • Successfully retrieves and processes notifications for users.
    • Provides efficient pagination and accurate i18n content resolution.
  3. Security and Data Integrity:

    • Ensures that user notifications are accessed only by the intended recipient.
    • Maintains the integrity and confidentiality of notification data.
  4. Comprehensive Testing:

    • Both libraries are thoroughly tested for all methods, ensuring reliability and robustness.
  5. Documentation:

    • Detailed documentation for each method, including parameters, return types, and usage examples.

Notes

  • Prioritize security in the notification-user library to safeguard against unauthorized access.
  • In the notification-admin library, focus on flexibility to accommodate future notification types and content structures.
  • Ensure compatibility with Hasura's GraphQL capabilities and permission system.
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