@runnerpro/backend 1.6.13 → 1.6.15
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.
|
@@ -39,7 +39,7 @@ const conversationRoute = (_a) => {
|
|
|
39
39
|
const uploadFile = (0, multer_1.default)({
|
|
40
40
|
dest: 'uploads/',
|
|
41
41
|
limits: {
|
|
42
|
-
fileSize:
|
|
42
|
+
fileSize: 50 * 1024 * 1024,
|
|
43
43
|
files: 1,
|
|
44
44
|
},
|
|
45
45
|
});
|
|
@@ -289,7 +289,7 @@ const orientationImage = (data, filePath, image = null, mimetype) => __awaiter(v
|
|
|
289
289
|
else if (orientation === 3)
|
|
290
290
|
rotate = 180;
|
|
291
291
|
if (rotate) {
|
|
292
|
-
image = yield image.rotate(
|
|
292
|
+
image = yield image.rotate(rotate);
|
|
293
293
|
}
|
|
294
294
|
return image.getBufferAsync(jimp_1.default.MIME_JPEG);
|
|
295
295
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"garmin.d.ts","sourceRoot":"","sources":["../../../../src/workout/garmin.ts"],"names":[],"mappings":"AAkOA,QAAA,MAAM,mBAAmB;;;
|
|
1
|
+
{"version":3,"file":"garmin.d.ts","sourceRoot":"","sources":["../../../../src/workout/garmin.ts"],"names":[],"mappings":"AAkOA,QAAA,MAAM,mBAAmB;;;EAWxB,CAAC;AAEF,QAAA,MAAM,mBAAmB,6CASxB,CAAC;AAEF,QAAA,MAAM,mBAAmB,6CAMxB,CAAC;AAEF,QAAA,MAAM,qBAAqB,6CAU1B,CAAC;AAEF,QAAA,MAAM,2BAA2B,4DAWhC,CAAC;AAIF,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendToWatch.d.ts","sourceRoot":"","sources":["../../../../src/workout/sendToWatch.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,kBAAkB;;;;;;
|
|
1
|
+
{"version":3,"file":"sendToWatch.d.ts","sourceRoot":"","sources":["../../../../src/workout/sendToWatch.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,kBAAkB;;;;;;EAmBvB,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -211,18 +211,14 @@ const getWorkoutGarminTargetValue = (workout, row) => {
|
|
|
211
211
|
}
|
|
212
212
|
};
|
|
213
213
|
const createWorkoutGarmin = (userid, workout) => __awaiter(void 0, void 0, void 0, function* () {
|
|
214
|
-
console.log('createWorkoutGarmin');
|
|
215
214
|
const workoutGarmin = translateWorkoutGarmin(workout);
|
|
216
|
-
console.log({ workoutGarmin });
|
|
217
215
|
const data = yield garminOauthActivity({
|
|
218
216
|
url: 'https://apis.garmin.com/training-api/workout',
|
|
219
217
|
userid,
|
|
220
218
|
params: workoutGarmin,
|
|
221
219
|
httpMethod: 'POST',
|
|
222
220
|
});
|
|
223
|
-
console.log({ data });
|
|
224
221
|
yield (0, db_1.query)('UPDATE [WORKOUT] SET [WORKOUT ID GARMIN] = ?, [WORKOUT OWNER GARMIN] = ? WHERE [ID] = ?', [data.workoutId, data.ownerId, workout.id]);
|
|
225
|
-
console.log('updateWorkoutGarmin');
|
|
226
222
|
return { workoutGarminId: data.workoutId, workoutGarminOwnerId: data.ownerId };
|
|
227
223
|
});
|
|
228
224
|
exports.createWorkoutGarmin = createWorkoutGarmin;
|
|
@@ -245,17 +241,6 @@ const deleteWorkoutGarmin = (userid, workout) => {
|
|
|
245
241
|
};
|
|
246
242
|
exports.deleteWorkoutGarmin = deleteWorkoutGarmin;
|
|
247
243
|
const scheduleWorkoutGarmin = (userid, workout) => {
|
|
248
|
-
console.log('scheduleWorkoutGarmin');
|
|
249
|
-
console.log(userid, workout);
|
|
250
|
-
console.log({
|
|
251
|
-
url: 'https://apis.garmin.com/training-api/schedule',
|
|
252
|
-
userid,
|
|
253
|
-
httpMethod: 'POST',
|
|
254
|
-
params: {
|
|
255
|
-
workoutId: workout.workoutGarminId,
|
|
256
|
-
date: workout.date,
|
|
257
|
-
},
|
|
258
|
-
});
|
|
259
244
|
return garminOauthActivity({
|
|
260
245
|
url: 'https://apis.garmin.com/training-api/schedule',
|
|
261
246
|
userid,
|
|
@@ -19,21 +19,17 @@ const common_1 = require("@runnerpro/common");
|
|
|
19
19
|
const moment_1 = __importDefault(require("moment"));
|
|
20
20
|
const sendWorkoutToWatch = (clientId, workoutId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
21
|
const [aplicacion] = yield (0, db_1.query)('SELECT [TIPO APLICATION] FROM [CLIENTE APLICACIONES] WHERE [ID CLIENTE] = ? AND [TIPO APLICATION] = ?', [clientId, common_1.TIPO_APLICACION.GARMIN]);
|
|
22
|
-
console.log({ aplicacion });
|
|
23
22
|
if (!aplicacion)
|
|
24
23
|
return { error: 'No tiene Garmin vinculado' };
|
|
25
24
|
// Obtener el workout
|
|
26
25
|
const [workout] = yield (0, db_1.query)('SELECT * FROM [WORKOUT] WHERE [ID] = ? AND [ID CLIENTE] = ?', [workoutId, clientId]);
|
|
27
|
-
console.log({ workout });
|
|
28
26
|
if (!workout)
|
|
29
27
|
throw new Error('Workout no encontrado');
|
|
30
28
|
const estructura = yield (0, db_1.query)('SELECT * FROM [WORKOUT STRUCTURE] WHERE [ID WORKOUT] = ? ORDER BY [INDEX]', [workoutId]);
|
|
31
|
-
console.log({ estructura });
|
|
32
29
|
if (estructura.length > 0)
|
|
33
30
|
workout.estructura = estructura;
|
|
34
31
|
// Llamar a la función que envía el workout al Garmin
|
|
35
32
|
const { workoutGarminId } = yield (0, garmin_1.createWorkoutGarmin)(clientId, workout);
|
|
36
|
-
console.log({ workoutGarminId });
|
|
37
33
|
yield (0, garmin_1.scheduleWorkoutGarmin)(clientId, { date: (0, moment_1.default)(workout.date).format('YYYY-MM-DD'), workoutGarminId });
|
|
38
34
|
return { success: true };
|
|
39
35
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runnerpro/backend",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.15",
|
|
4
4
|
"description": "A collection of common backend functions",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./lib/cjs/index.js"
|
|
@@ -70,4 +70,5 @@
|
|
|
70
70
|
"socket.io": "^4.7.2",
|
|
71
71
|
"oauth-signature": "1.5.0"
|
|
72
72
|
}
|
|
73
|
-
}
|
|
73
|
+
}
|
|
74
|
+
|