Skip to content

[Service] Product Follow Contract Service for StarShop Frontend #286

@aguilar1x

Description

@aguilar1x

🎯 Objective

Develop a comprehensive TypeScript service layer for the Product Follow Contract that manages product following, notifications, alerts, and user preferences within the StarShop marketplace.


🏗 Service Structure

src/shared/services/product_follow/
  follow.service.ts                // Main service class
  types/
    follow.types.ts               // TypeScript interfaces
    notification.types.ts         // Notification types
    alert.types.ts                // Alert types
  utils/
    follow.utils.ts               // Helper functions
  constants/
    follow.constants.ts           // Contract addresses, error codes

🗂 Requirements

1. Follow Management

  • followProduct(productId, user) - Follow product
  • unfollowProduct(productId, user) - Unfollow product
  • getFollowers(productId) - Get product followers
  • getFollowing(user) - Get user's followed products
  • isFollowing(productId, user) - Check if user follows product

2. Notification Management

  • setNotificationPreferences(user, preferences) - Set preferences
  • getNotificationPreferences(user) - Get preferences
  • sendNotification(productId, type, data) - Send notification
  • getNotificationHistory(user) - Get notification history

3. Alert Management

  • createAlert(productId, conditions) - Create price/stock alert
  • updateAlert(alertId, conditions) - Update alert
  • deleteAlert(alertId) - Delete alert
  • getAlerts(user) - Get user's alerts
  • triggerAlert(alertId) - Trigger alert

4. Rate Limiting & Validation

  • checkRateLimit(user, action) - Check rate limits
  • validateNotificationFormat(data) - Validate notification
  • validateUserPreferences(preferences) - Validate preferences

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions