goldstars-services 1.0.54 → 1.0.55

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.
@@ -241,9 +241,36 @@ var cancelReservation = /*#__PURE__*/function () {
241
241
  return _ref4.apply(this, arguments);
242
242
  };
243
243
  }();
244
+
245
+ /**
246
+ * Obtiene todas las reservaciones de un usuario específico.
247
+ * @param {string} userId - El ID del usuario.
248
+ * @returns {Promise<Array<object>>} - Un arreglo de documentos de reservación.
249
+ * @throws {Error} - Si no se proporciona el ID de usuario.
250
+ */
251
+ var getReservationsByUserId = /*#__PURE__*/function () {
252
+ var _ref5 = _asyncToGenerator(function* (userId) {
253
+ if (!userId) {
254
+ throw new Error('El ID de usuario es requerido para obtener las reservaciones.');
255
+ }
256
+ var reservations = yield _reservationModel.default.find({
257
+ userId
258
+ }).populate('bikeId', 'name location') // Popula el nombre y ubicación de la bicicleta
259
+ .sort({
260
+ timestamp: -1
261
+ }); // Ordena por fecha más reciente primero
262
+
263
+ return reservations;
264
+ });
265
+ return function getReservationsByUserId(_x9) {
266
+ return _ref5.apply(this, arguments);
267
+ };
268
+ }();
244
269
  var _default = exports.default = {
245
270
  getBikeAvailabilityForSlot,
246
271
  createReservation,
247
272
  cancelReservation,
248
- isBikeReserved // Keep exporting isBikeReserved if used elsewhere, otherwise could be removed if only internal
273
+ isBikeReserved,
274
+ // Keep exporting isBikeReserved if used elsewhere, otherwise could be removed if only internal
275
+ getReservationsByUserId
249
276
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goldstars-services",
3
- "version": "1.0.54",
3
+ "version": "1.0.55",
4
4
  "description": "This is the services layer for GoldStars",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {