bulltrackers-module 1.0.686 → 1.0.687

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -392,7 +392,10 @@ const manageUserWatchlist = async (db, userId, instruction, payload = {}) => {
392
392
  const sanitizedUserId = sanitizeCid(userId);
393
393
 
394
394
  // 1. Determine Watchlist ID and Reference
395
- const watchlistId = payload.id ? sanitizeDocId(payload.id) : `watchlist_${Date.now()}_${Math.random().toString(16).substr(2, 8)}`;
395
+ // Handle both 'id' (from frontend) and 'watchlistId' (legacy)
396
+ const watchlistId = payload.id ? sanitizeDocId(payload.id)
397
+ : payload.watchlistId ? sanitizeDocId(payload.watchlistId)
398
+ : `watchlist_${Date.now()}_${Math.random().toString(16).substr(2, 8)}`;
396
399
  const userDocRef = db.collection('SignedInUsers').doc(sanitizedUserId).collection('watchlists').doc(watchlistId);
397
400
 
398
401
  try {
@@ -20,14 +20,15 @@ const router = express.Router();
20
20
  const watchlistManageSchema = z.object({
21
21
  instruction: z.enum(['create', 'update', 'delete', 'add_item', 'remove_item', 'update_item']),
22
22
  payload: z.object({
23
- watchlistId: z.string().optional(),
23
+ id: z.string().optional(), // Frontend sends "id"
24
+ watchlistId: z.string().optional(), // Keep for backward compatibility
24
25
  name: z.string().max(200).optional(),
25
26
  description: z.string().max(1000).optional(),
26
- type: z.enum(['static', 'dynamic']).optional(), // FIX: Allow type field!
27
- visibility: z.enum(['public', 'private']).optional(), // FIX: Allow visibility field!
27
+ type: z.enum(['static', 'dynamic']).optional(),
28
+ visibility: z.enum(['public', 'private']).optional(),
28
29
  items: z.array(z.any()).optional(),
29
30
  item: z.any().optional(),
30
- dynamicConfig: z.any().optional() // FIX: Allow dynamicConfig for dynamic watchlists!
31
+ dynamicConfig: z.any().optional()
31
32
  })
32
33
  });
33
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.686",
3
+ "version": "1.0.687",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [