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
|
-
|
|
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
|
-
|
|
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(),
|
|
27
|
-
visibility: z.enum(['public', 'private']).optional(),
|
|
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()
|
|
31
|
+
dynamicConfig: z.any().optional()
|
|
31
32
|
})
|
|
32
33
|
});
|
|
33
34
|
|