@runnerpro/backend 1.32.0 → 1.33.0
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.
- package/lib/cjs/types/workout/saveWorkoutAplication.d.ts.map +1 -1
- package/lib/cjs/workout/saveWorkoutAplication.js +18 -11
- package/package.json +1 -1
- package/lib/cjs/translation/titleDescriptionTranslated.js +0 -38
- package/lib/cjs/types/translation/titleDescriptionTranslated.d.ts +0 -8
- package/lib/cjs/types/translation/titleDescriptionTranslated.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveWorkoutAplication.d.ts","sourceRoot":"","sources":["../../../../src/workout/saveWorkoutAplication.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"saveWorkoutAplication.d.ts","sourceRoot":"","sources":["../../../../src/workout/saveWorkoutAplication.ts"],"names":[],"mappings":"AAsTA;;;;;;;;;;GAUG;AACH,QAAA,MAAM,qBAAqB,SACnB,GAAG,UAED,GAAG,KACV,QAAQ,MAAM,GAAG,IAAI,CAqFvB,CAAC;AA0GF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.saveWorkoutAplication = void 0;
|
|
16
16
|
const db_1 = require("../db");
|
|
17
|
-
const titleDescriptionTranslated_1 = require("../translation/titleDescriptionTranslated");
|
|
18
17
|
const storage_1 = require("@google-cloud/storage");
|
|
19
18
|
const path_1 = __importDefault(require("path"));
|
|
20
19
|
const axios_1 = __importDefault(require("axios"));
|
|
@@ -316,16 +315,24 @@ _data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
316
315
|
}
|
|
317
316
|
const dateStr = (0, moment_1.default)(opts.date).format('YYYY-MM-DD');
|
|
318
317
|
const pt = predicadoTipo(opts);
|
|
319
|
-
//
|
|
320
|
-
//
|
|
321
|
-
//
|
|
322
|
-
//
|
|
323
|
-
//
|
|
324
|
-
// se
|
|
325
|
-
//
|
|
326
|
-
//
|
|
327
|
-
//
|
|
328
|
-
|
|
318
|
+
// SIN traducción en la ingesta: título y descripción se guardan tal cual llegan
|
|
319
|
+
// del proveedor (Garmin/Strava/Apple). Antes se traducían al español con Google
|
|
320
|
+
// Cloud Translation, lo que metía una llamada de red —y una dependencia de las
|
|
321
|
+
// credenciales de GCP— en el camino crítico del guardado: si Translate fallaba,
|
|
322
|
+
// el entreno NO se guardaba y el webhook devolvía 5xx. Con la migración a Azure
|
|
323
|
+
// eso se rompió (sin metadata server, las ADC resuelven a la service account de
|
|
324
|
+
// Storage, que no tiene permiso de Translate → PERMISSION_DENIED) y dos
|
|
325
|
+
// actividades envenenadas bastaron para atascar la cola de reintentos de Garmin
|
|
326
|
+
// y frenar la ingesta del resto.
|
|
327
|
+
// Consecuencia asumida: para clientes no-ES el "TITLE" queda en el idioma del
|
|
328
|
+
// dispositivo en vez de normalizado a español —lo notan entrenadores y la IA, no
|
|
329
|
+
// el cliente: la app cae a "TITLE" cuando "TITLE PREFERRED LANGUAGE" es null.
|
|
330
|
+
const translated = {
|
|
331
|
+
title: opts.title,
|
|
332
|
+
description: opts.description,
|
|
333
|
+
titlePreferredLanguage: null,
|
|
334
|
+
descriptionPreferredLanguage: null,
|
|
335
|
+
};
|
|
329
336
|
const idWorkout = yield withTx((q) => __awaiter(void 0, void 0, void 0, function* () {
|
|
330
337
|
var _e;
|
|
331
338
|
// Lock anti-carrera: serializa ingestas del mismo cliente/día/bucket-tipo
|
package/package.json
CHANGED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getTitleDescriptionTranslated = void 0;
|
|
13
|
-
const db_1 = require("../db");
|
|
14
|
-
const index_1 = require("./index");
|
|
15
|
-
const common_1 = require("@runnerpro/common");
|
|
16
|
-
const getTitleDescriptionTranslated = (idCliente, titleOriginal, descriptionOriginal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
let title;
|
|
18
|
-
let description;
|
|
19
|
-
let titlePreferredLanguage;
|
|
20
|
-
let descriptionPreferredLanguage;
|
|
21
|
-
const [cliente] = yield (0, db_1.query)('SELECT [PREFERRED LANGUAGE] FROM [CLIENTE] WHERE [ID] = ?', [idCliente]);
|
|
22
|
-
if ((cliente === null || cliente === void 0 ? void 0 : cliente.preferredLanguage) && cliente.preferredLanguage !== common_1.LANGUAGES.ES) {
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
title = titleOriginal ? yield (0, index_1.translate)(titleOriginal, { fromLanguage: cliente.preferredLanguage, toLanguage: common_1.LANGUAGES.ES }) : null;
|
|
25
|
-
description = descriptionOriginal
|
|
26
|
-
? // @ts-ignore
|
|
27
|
-
yield (0, index_1.translate)(descriptionOriginal, { fromLanguage: cliente.preferredLanguage, toLanguage: common_1.LANGUAGES.ES })
|
|
28
|
-
: null;
|
|
29
|
-
titlePreferredLanguage = titleOriginal;
|
|
30
|
-
descriptionPreferredLanguage = descriptionOriginal;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
title = titleOriginal;
|
|
34
|
-
description = descriptionOriginal;
|
|
35
|
-
}
|
|
36
|
-
return { title, description, titlePreferredLanguage, descriptionPreferredLanguage };
|
|
37
|
-
});
|
|
38
|
-
exports.getTitleDescriptionTranslated = getTitleDescriptionTranslated;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare const getTitleDescriptionTranslated: (idCliente: any, titleOriginal: any, descriptionOriginal: any) => Promise<{
|
|
2
|
-
title: any;
|
|
3
|
-
description: any;
|
|
4
|
-
titlePreferredLanguage: any;
|
|
5
|
-
descriptionPreferredLanguage: any;
|
|
6
|
-
}>;
|
|
7
|
-
export { getTitleDescriptionTranslated };
|
|
8
|
-
//# sourceMappingURL=titleDescriptionTranslated.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"titleDescriptionTranslated.d.ts","sourceRoot":"","sources":["../../../../src/translation/titleDescriptionTranslated.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,6BAA6B;;;;;EAsBlC,CAAC;AAEF,OAAO,EAAE,6BAA6B,EAAE,CAAC"}
|