-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Labels
Description
🎯 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 productunfollowProduct(productId, user)- Unfollow productgetFollowers(productId)- Get product followersgetFollowing(user)- Get user's followed productsisFollowing(productId, user)- Check if user follows product
2. Notification Management
setNotificationPreferences(user, preferences)- Set preferencesgetNotificationPreferences(user)- Get preferencessendNotification(productId, type, data)- Send notificationgetNotificationHistory(user)- Get notification history
3. Alert Management
createAlert(productId, conditions)- Create price/stock alertupdateAlert(alertId, conditions)- Update alertdeleteAlert(alertId)- Delete alertgetAlerts(user)- Get user's alertstriggerAlert(alertId)- Trigger alert
4. Rate Limiting & Validation
checkRateLimit(user, action)- Check rate limitsvalidateNotificationFormat(data)- Validate notificationvalidateUserPreferences(preferences)- Validate preferences