tt-help-cli-ycl 1.3.64 → 1.3.72

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.
@@ -439,6 +439,29 @@ export function startWatchServer(dataAnchor, port = 3000, existingStore) {
439
439
  return;
440
440
  }
441
441
 
442
+ const userLocationMatch = routePath.match(
443
+ /^\/api\/user-location\/([^/]+)$/,
444
+ );
445
+ if (req.method === "PUT" && userLocationMatch) {
446
+ const uniqueId = userLocationMatch[1];
447
+ try {
448
+ const body = await readBody(req);
449
+ const ret = store.updateUserLocation(uniqueId, body.location);
450
+ if (ret.error) {
451
+ sendJSON(res, 404, { error: ret.error });
452
+ return;
453
+ }
454
+ const ts = new Date().toISOString().slice(11, 19);
455
+ console.error(
456
+ `[JOB ${ts}] USER-LOCATION: ${uniqueId} → ${body.location} (modifiedAt=${ret.modifiedAt})`,
457
+ );
458
+ sendJSON(res, 200, ret);
459
+ } catch (e) {
460
+ sendJSON(res, 400, { error: e.message });
461
+ }
462
+ return;
463
+ }
464
+
442
465
  if (req.method === "GET" && routePath === "/api/comment-tasks") {
443
466
  const limit = parseInt(params.limit) || 1;
444
467
  const tasks = store.getPendingCommentTasks(limit);