@runnerpro/backend 1.7.3 → 1.7.5
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/db/index.js +2 -0
- package/lib/cjs/image/generateShareMap.js +1 -1
- package/lib/cjs/types/db/index.d.ts.map +1 -1
- package/lib/cjs/types/image/generateShareMap.d.ts +2 -2
- package/lib/cjs/types/image/generateShareMap.d.ts.map +1 -1
- package/lib/cjs/types/workout/estructuraWorkout.d.ts +2 -1
- package/lib/cjs/types/workout/estructuraWorkout.d.ts.map +1 -1
- package/lib/cjs/types/workout/planificacionPrueba7dias/index.d.ts.map +1 -1
- package/lib/cjs/workout/estructuraWorkout.js +37 -1
- package/lib/cjs/workout/planificacionPrueba7dias/index.js +0 -8
- package/package.json +4 -3
package/lib/cjs/db/index.js
CHANGED
|
@@ -25,7 +25,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
25
25
|
// install fonts
|
|
26
26
|
canvas_1.GlobalFonts.registerFromPath(path_1.default.join(__dirname, '../../..', 'static/fonts', 'SofiaSans-Bold.ttf'), 'SofiaSansBold');
|
|
27
27
|
canvas_1.GlobalFonts.registerFromPath(path_1.default.join(__dirname, '../../..', 'static/fonts', 'SofiaSans-Regular.ttf'), 'SofiaSans');
|
|
28
|
-
const generateShareMap = (image, idWorkout, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
const generateShareMap = (image, idWorkout, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
29
|
const useDefaultPhoto = (options === null || options === void 0 ? void 0 : options.useDefaultPhoto) || false;
|
|
30
30
|
const [workout] = yield (0, index_1.query)('SELECT [ID], [ID CLIENTE], [TYPE], [DISTANCE], [DURATION], [DESNIVEL] FROM [WORKOUT] WHERE [ID] = ?', [idWorkout]);
|
|
31
31
|
const [cliente] = yield (0, index_1.query)('SELECT [PREFERRED LANGUAGE] FROM [CLIENTE] WHERE [ID] = ?', [workout.idCliente]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,IAAI,CAAC;AAI5B,QAAA,MAAM,IAAI,iBAMR,CAAC;AAEH,QAAA,MAAM,KAAK,cAAqB,MAAM,WAAU,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,IAAI,CAAC;AAI5B,QAAA,MAAM,IAAI,iBAMR,CAAC;AAEH,QAAA,MAAM,KAAK,cAAqB,MAAM,WAAU,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,iBA8B5E,CAAC;AAEF,QAAA,MAAM,SAAS,QAAS,MAAM,EAAE,WAM/B,CAAC;AA+BF,QAAA,MAAM,UAAU,YAAmB,GAAG,mCAUrC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
declare const generateShareMap: (image: any, idWorkout: any, options
|
|
3
|
-
export { generateShareMap
|
|
2
|
+
declare const generateShareMap: (image: any, idWorkout: any, options?: {}) => Promise<Buffer>;
|
|
3
|
+
export { generateShareMap };
|
|
4
4
|
//# sourceMappingURL=generateShareMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateShareMap.d.ts","sourceRoot":"","sources":["../../../../src/image/generateShareMap.ts"],"names":[],"mappings":";AAcA,QAAA,MAAM,gBAAgB,+DAkBrB,CAAC;AA0HF,OAAO,
|
|
1
|
+
{"version":3,"file":"generateShareMap.d.ts","sourceRoot":"","sources":["../../../../src/image/generateShareMap.ts"],"names":[],"mappings":";AAcA,QAAA,MAAM,gBAAgB,+DAkBrB,CAAC;AA0HF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare const getStructuraWorkout: (workout: any, estructura: any) => any;
|
|
2
2
|
declare const saveWorkoutEstructuraNotDone: (idWorkout: any, data: any) => Promise<void>;
|
|
3
3
|
declare const savePlantillaEstructuraNotDone: (idPlantilla: any, data: any) => Promise<void>;
|
|
4
|
-
|
|
4
|
+
declare const saveDoneStructuraWorkout: (idWorkout: any, estructura: any, workoutType: any) => Promise<void>;
|
|
5
|
+
export { getStructuraWorkout, saveWorkoutEstructuraNotDone, savePlantillaEstructuraNotDone, saveDoneStructuraWorkout };
|
|
5
6
|
//# sourceMappingURL=estructuraWorkout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estructuraWorkout.d.ts","sourceRoot":"","sources":["../../../../src/workout/estructuraWorkout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"estructuraWorkout.d.ts","sourceRoot":"","sources":["../../../../src/workout/estructuraWorkout.ts"],"names":[],"mappings":"AA4DA,QAAA,MAAM,mBAAmB,wCAiCxB,CAAC;AAmCF,QAAA,MAAM,4BAA4B,8CAkBjC,CAAC;AAEF,QAAA,MAAM,8BAA8B,gDAkBnC,CAAC;AAEF,QAAA,MAAM,wBAAwB,sEAkC7B,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,8BAA8B,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/workout/planificacionPrueba7dias/index.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,2BAA2B,qBAAgB,GAAG,UAoDnD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/workout/planificacionPrueba7dias/index.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,2BAA2B,qBAAgB,GAAG,UAoDnD,CAAC;AAmIF,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
|
|
@@ -9,8 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.savePlantillaEstructuraNotDone = exports.saveWorkoutEstructuraNotDone = exports.getStructuraWorkout = void 0;
|
|
12
|
+
exports.saveDoneStructuraWorkout = exports.savePlantillaEstructuraNotDone = exports.saveWorkoutEstructuraNotDone = exports.getStructuraWorkout = void 0;
|
|
13
13
|
const db_1 = require("../db");
|
|
14
|
+
const common_1 = require("@runnerpro/common");
|
|
14
15
|
const calculateZone = (values) => {
|
|
15
16
|
const percentage = Number(values.pacePercentage);
|
|
16
17
|
if (percentage <= 70)
|
|
@@ -149,3 +150,38 @@ const savePlantillaEstructuraNotDone = (idPlantilla, data) => __awaiter(void 0,
|
|
|
149
150
|
}
|
|
150
151
|
});
|
|
151
152
|
exports.savePlantillaEstructuraNotDone = savePlantillaEstructuraNotDone;
|
|
153
|
+
const saveDoneStructuraWorkout = (idWorkout, estructura, workoutType) => __awaiter(void 0, void 0, void 0, function* () {
|
|
154
|
+
const estructuraBBDD = yield (0, db_1.query)('SELECT * FROM [WORKOUT STRUCTURE] WHERE [ID WORKOUT] = ? ORDER BY [INDEX]', [idWorkout]);
|
|
155
|
+
let i = 0;
|
|
156
|
+
for (const row of estructuraBBDD) {
|
|
157
|
+
let distance = 0;
|
|
158
|
+
let duration = 0;
|
|
159
|
+
let distancePlanned = 0;
|
|
160
|
+
let durationPlanned = 0;
|
|
161
|
+
const pace = estructura ? estructura[i].valueMetric2 : row.valueMetric2;
|
|
162
|
+
const pacePlanned = row.valueMetric2;
|
|
163
|
+
if (Number(row.typeMetric1) === 1) {
|
|
164
|
+
distancePlanned = row.valueMetric1;
|
|
165
|
+
distance = row.valueMetric1;
|
|
166
|
+
durationPlanned = (0, common_1.getWorkoutParamsByType)(workoutType).calculateDuration({ distance: row.valueMetric1, pace: pacePlanned });
|
|
167
|
+
duration = (0, common_1.getWorkoutParamsByType)(workoutType).calculateDuration({ distance: row.valueMetric1, pace });
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
durationPlanned = row.valueMetric1;
|
|
171
|
+
duration = row.valueMetric1;
|
|
172
|
+
if (Number(row.type) === 3) {
|
|
173
|
+
// @ts-ignore
|
|
174
|
+
distancePlanned = null;
|
|
175
|
+
// @ts-ignore
|
|
176
|
+
distance = null;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
distancePlanned = (0, common_1.getWorkoutParamsByType)(workoutType).calculateDistance({ duration: row.valueMetric1, pace: pacePlanned, decimals: 2 });
|
|
180
|
+
distance = (0, common_1.getWorkoutParamsByType)(workoutType).calculateDistance({ duration: row.valueMetric1, pace, decimals: 2 });
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
i++;
|
|
184
|
+
yield (0, db_1.query)('UPDATE [WORKOUT STRUCTURE] SET [DISTANCE PLANNED] = ?, [DISTANCE] = ?, [DURATION PLANNED] = ?, [DURATION] = ?, [DESNIVEL] = ? WHERE [INDEX] = ? AND [ID WORKOUT] = ?', [distancePlanned, distance, durationPlanned, duration, row.desnivelPlanned, row.index, idWorkout]);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
exports.saveDoneStructuraWorkout = saveDoneStructuraWorkout;
|
|
@@ -199,11 +199,3 @@ const addWorkoutFuerza = () => {
|
|
|
199
199
|
],
|
|
200
200
|
};
|
|
201
201
|
};
|
|
202
|
-
function camelize(str) {
|
|
203
|
-
return str
|
|
204
|
-
.toLowerCase()
|
|
205
|
-
.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
|
|
206
|
-
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
207
|
-
})
|
|
208
|
-
.replace(/\s+/g, '');
|
|
209
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runnerpro/backend",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"description": "A collection of common backend functions",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./lib/cjs/index.js"
|
|
@@ -62,13 +62,14 @@
|
|
|
62
62
|
"uuidv4": "^6.2.13"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
+
"@google-cloud/storage": "^7.11.3",
|
|
65
66
|
"@google-cloud/translate": "^8.3.0",
|
|
66
67
|
"@notionhq/client": "^2.2.15",
|
|
67
68
|
"exifr": "^7.1.3",
|
|
68
69
|
"googleapis": "^144.0.0",
|
|
69
70
|
"multer": "^1.4.5-lts.1",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
71
|
+
"oauth-signature": "1.5.0",
|
|
72
|
+
"socket.io": "^4.7.2"
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
|