@runnerpro/backend 1.21.0 → 1.21.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"saveWorkoutAplication.d.ts","sourceRoot":"","sources":["../../../../src/workout/saveWorkoutAplication.ts"],"names":[],"mappings":"AAsPA;;;;;;;;;GASG;AACH,QAAA,MAAM,qBAAqB,SACnB,GAAG,UAED,GAAG,KACV,QAAQ,MAAM,GAAG,IAAI,CAmDvB,CAAC;AA+DF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"saveWorkoutAplication.d.ts","sourceRoot":"","sources":["../../../../src/workout/saveWorkoutAplication.ts"],"names":[],"mappings":"AAsPA;;;;;;;;;GASG;AACH,QAAA,MAAM,qBAAqB,SACnB,GAAG,UAED,GAAG,KACV,QAAQ,MAAM,GAAG,IAAI,CA0DvB,CAAC;AA+DF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -252,9 +252,16 @@ _data) => __awaiter(void 0, void 0, void 0, function* () {
252
252
  // (Strava-webhook y Garmin-push pueden entrar casi a la vez).
253
253
  yield q('SELECT pg_advisory_xact_lock(?)', [hashInt(`${opts.idCliente}|${dateStr}|${bucketTipo(opts.type)}`)]);
254
254
  // 1) dedup intra-proveedor / completar planificado (comportamiento actual común).
255
+ // Ambas ramas filtran por "ID CLIENTE": el activityId de un proveedor es
256
+ // global pero pertenece a un único usuario en su plataforma; si por
257
+ // cualquier motivo (test, re-conexión OAuth con cuenta distinta, fallo
258
+ // de resolución upstream) llegara con un idCliente distinto al que ya
259
+ // tenía esa fila, NO debemos hacer merge cross-cliente.
255
260
  const [exist] = yield q(`SELECT "ID", "TYPE" FROM "WORKOUT"
256
- WHERE ("ID CLIENTE" = ? AND "DATE" = ? AND ${pt.sql} AND "DONE" = FALSE AND "SHOW CLIENT" = TRUE)
257
- OR ("ID APLICATION" = ? AND "TIPO APLICATION" = ?)
261
+ WHERE "ID CLIENTE" = ? AND (
262
+ ("DATE" = ? AND ${pt.sql} AND "DONE" = FALSE AND "SHOW CLIENT" = TRUE)
263
+ OR ("ID APLICATION" = ? AND "TIPO APLICATION" = ?)
264
+ )
258
265
  LIMIT 1`, [opts.idCliente, dateStr, ...pt.params, opts.aplicationId, opts.aplicationType]);
259
266
  if (exist) {
260
267
  yield aplicarMerge(q, exist.id, opts, false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.21.0",
3
+ "version": "1.21.1",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"