@oxyhq/services 5.9.11 → 5.9.13

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.
Files changed (53) hide show
  1. package/lib/commonjs/core/OxyServices.js +1 -1
  2. package/lib/commonjs/core/OxyServices.js.map +1 -1
  3. package/lib/commonjs/core/OxyServicesMain.js +1 -1
  4. package/lib/commonjs/core/OxyServicesMain.js.map +1 -1
  5. package/lib/commonjs/core/analytics/AnalyticsService.js +4 -4
  6. package/lib/commonjs/core/analytics/AnalyticsService.js.map +1 -1
  7. package/lib/commonjs/core/auth/AuthService.js +53 -39
  8. package/lib/commonjs/core/auth/AuthService.js.map +1 -1
  9. package/lib/commonjs/core/devices/DeviceService.js +3 -3
  10. package/lib/commonjs/core/devices/DeviceService.js.map +1 -1
  11. package/lib/commonjs/core/files/FileService.js +7 -7
  12. package/lib/commonjs/core/files/FileService.js.map +1 -1
  13. package/lib/commonjs/core/karma/KarmaService.js +2 -2
  14. package/lib/commonjs/core/karma/KarmaService.js.map +1 -1
  15. package/lib/commonjs/core/locations/LocationService.js +4 -4
  16. package/lib/commonjs/core/locations/LocationService.js.map +1 -1
  17. package/lib/commonjs/core/payments/PaymentService.js +4 -4
  18. package/lib/commonjs/core/payments/PaymentService.js.map +1 -1
  19. package/lib/commonjs/core/users/UserService.js +18 -18
  20. package/lib/commonjs/core/users/UserService.js.map +1 -1
  21. package/lib/module/core/OxyServices.js +1 -1
  22. package/lib/module/core/OxyServices.js.map +1 -1
  23. package/lib/module/core/OxyServicesMain.js +1 -1
  24. package/lib/module/core/OxyServicesMain.js.map +1 -1
  25. package/lib/module/core/analytics/AnalyticsService.js +4 -4
  26. package/lib/module/core/analytics/AnalyticsService.js.map +1 -1
  27. package/lib/module/core/auth/AuthService.js +53 -39
  28. package/lib/module/core/auth/AuthService.js.map +1 -1
  29. package/lib/module/core/devices/DeviceService.js +3 -3
  30. package/lib/module/core/devices/DeviceService.js.map +1 -1
  31. package/lib/module/core/files/FileService.js +7 -7
  32. package/lib/module/core/files/FileService.js.map +1 -1
  33. package/lib/module/core/karma/KarmaService.js +2 -2
  34. package/lib/module/core/karma/KarmaService.js.map +1 -1
  35. package/lib/module/core/locations/LocationService.js +4 -4
  36. package/lib/module/core/locations/LocationService.js.map +1 -1
  37. package/lib/module/core/payments/PaymentService.js +4 -4
  38. package/lib/module/core/payments/PaymentService.js.map +1 -1
  39. package/lib/module/core/users/UserService.js +18 -18
  40. package/lib/module/core/users/UserService.js.map +1 -1
  41. package/lib/typescript/core/auth/AuthService.d.ts +1 -3
  42. package/lib/typescript/core/auth/AuthService.d.ts.map +1 -1
  43. package/package.json +2 -2
  44. package/src/core/OxyServices.ts +1 -1
  45. package/src/core/OxyServicesMain.ts +1 -1
  46. package/src/core/analytics/AnalyticsService.ts +4 -4
  47. package/src/core/auth/AuthService.ts +66 -46
  48. package/src/core/devices/DeviceService.ts +3 -3
  49. package/src/core/files/FileService.ts +7 -7
  50. package/src/core/karma/KarmaService.ts +2 -2
  51. package/src/core/locations/LocationService.ts +4 -4
  52. package/src/core/payments/PaymentService.ts +4 -4
  53. package/src/core/users/UserService.ts +18 -18
@@ -20,7 +20,7 @@ export class AuthService extends OxyServices {
20
20
  */
21
21
  async signUp(username: string, email: string, password: string): Promise<{ message: string; token: string; user: User }> {
22
22
  try {
23
- const res = await this.getClient().post('/session/register', {
23
+ const res = await this.getClient().post('/auth/signup', {
24
24
  username,
25
25
  email,
26
26
  password
@@ -36,7 +36,7 @@ export class AuthService extends OxyServices {
36
36
  */
37
37
  async signIn(username: string, password: string, deviceName?: string, deviceFingerprint?: any): Promise<SessionLoginResponse> {
38
38
  try {
39
- const res = await this.getClient().post('/session/login', {
39
+ const res = await this.getClient().post('/auth/login', {
40
40
  username,
41
41
  password,
42
42
  deviceName,
@@ -53,7 +53,7 @@ export class AuthService extends OxyServices {
53
53
  */
54
54
  async getUserBySession(sessionId: string): Promise<User> {
55
55
  try {
56
- const res = await this.getClient().get(`/session/user/${sessionId}`);
56
+ const res = await this.getClient().get(`/api/session/user/${sessionId}`);
57
57
  return res.data;
58
58
  } catch (error) {
59
59
  throw this.handleError(error);
@@ -65,7 +65,7 @@ export class AuthService extends OxyServices {
65
65
  */
66
66
  async getTokenBySession(sessionId: string): Promise<{ accessToken: string; expiresAt: string }> {
67
67
  try {
68
- const res = await this.getClient().get(`/session/token/${sessionId}`);
68
+ const res = await this.getClient().get(`/api/session/token/${sessionId}`);
69
69
  return res.data;
70
70
  } catch (error) {
71
71
  throw this.handleError(error);
@@ -77,7 +77,7 @@ export class AuthService extends OxyServices {
77
77
  */
78
78
  async getSessionsBySessionId(sessionId: string): Promise<any[]> {
79
79
  try {
80
- const res = await this.getClient().get(`/session/sessions/${sessionId}`);
80
+ const res = await this.getClient().get(`/api/session/sessions/${sessionId}`);
81
81
  return res.data;
82
82
  } catch (error) {
83
83
  throw this.handleError(error);
@@ -89,7 +89,7 @@ export class AuthService extends OxyServices {
89
89
  */
90
90
  async logoutSession(sessionId: string, targetSessionId?: string): Promise<void> {
91
91
  try {
92
- await this.getClient().delete(`/session/logout/${sessionId}`, {
92
+ await this.getClient().delete(`/api/session/logout/${sessionId}`, {
93
93
  data: { targetSessionId }
94
94
  });
95
95
  } catch (error) {
@@ -102,7 +102,7 @@ export class AuthService extends OxyServices {
102
102
  */
103
103
  async logoutAllSessions(sessionId: string): Promise<void> {
104
104
  try {
105
- await this.getClient().delete(`/session/logout-all/${sessionId}`);
105
+ await this.getClient().delete(`/api/session/logout-all/${sessionId}`);
106
106
  } catch (error) {
107
107
  throw this.handleError(error);
108
108
  }
@@ -148,13 +148,19 @@ export class AuthService extends OxyServices {
148
148
  try {
149
149
  if (useHeaderValidation) {
150
150
  // Use header-based validation with device fingerprint
151
- const res = await this.getClient().get(`/session/validate-header/${sessionId}`, {
152
- headers: deviceFingerprint ? { 'X-Device-Fingerprint': deviceFingerprint } : {}
151
+ const headers: Record<string, string> = {};
152
+
153
+ if (deviceFingerprint) {
154
+ headers['X-Device-Fingerprint'] = deviceFingerprint;
155
+ }
156
+
157
+ const res = await this.getClient().get(`/api/session/validate-header/${sessionId}`, {
158
+ headers
153
159
  });
154
160
  return { ...res.data, source: 'header' };
155
161
  } else {
156
162
  // Use standard session validation
157
- const res = await this.getClient().get(`/session/validate/${sessionId}`);
163
+ const res = await this.getClient().get(`/api/session/validate/${sessionId}`);
158
164
  return { ...res.data, source: 'standard' };
159
165
  }
160
166
  } catch (error) {
@@ -267,8 +273,8 @@ export class AuthService extends OxyServices {
267
273
  // Validate session or token
268
274
  let isValid = false;
269
275
  let user: User | null = null;
270
-
271
- if (decoded.sessionId) {
276
+
277
+ if (decoded.sessionId) {
272
278
  // Session-based validation
273
279
  if (debug) console.log(`🔐 Auth Middleware: Using session validation for session: ${decoded.sessionId}`);
274
280
 
@@ -286,8 +292,8 @@ export class AuthService extends OxyServices {
286
292
  } catch (sessionError) {
287
293
  if (debug) console.log(`❌ Auth Middleware: Session validation failed:`, sessionError);
288
294
  isValid = false;
289
- }
290
- } else {
295
+ }
296
+ } else {
291
297
  // Legacy token validation
292
298
  if (debug) console.log(`🔐 Auth Middleware: Using legacy token validation`);
293
299
 
@@ -297,7 +303,7 @@ export class AuthService extends OxyServices {
297
303
  if (isValid && loadFullUser) {
298
304
  // Use minimal user data for performance - full user can be loaded separately if needed
299
305
  user = { id: userId } as User;
300
- }
306
+ }
301
307
 
302
308
  if (debug) {
303
309
  console.log(`🔐 Auth Middleware: Legacy validation result: ${isValid}`);
@@ -395,7 +401,7 @@ export class AuthService extends OxyServices {
395
401
  };
396
402
  }
397
403
 
398
- const userId = decoded.userId || decoded.id;
404
+ const userId = decoded.userId || decoded.id;
399
405
  if (!userId) {
400
406
  return {
401
407
  valid: false,
@@ -404,26 +410,26 @@ export class AuthService extends OxyServices {
404
410
  }
405
411
 
406
412
  // Validate based on token type
407
- if (decoded.sessionId) {
413
+ if (decoded.sessionId) {
408
414
  // Session-based validation
409
415
  try {
410
416
  const validation = await this.validateSession(decoded.sessionId, {
411
417
  useHeaderValidation: true
412
418
  });
413
- return {
419
+ return {
414
420
  valid: validation.valid,
415
- userId,
421
+ userId,
416
422
  user: validation.user,
417
423
  error: validation.valid ? undefined : 'Invalid or expired session'
418
- };
424
+ };
419
425
  } catch (sessionError) {
420
- return {
421
- valid: false,
426
+ return {
427
+ valid: false,
422
428
  userId,
423
429
  error: 'Session validation failed'
424
- };
425
- }
426
- } else {
430
+ };
431
+ }
432
+ } else {
427
433
  // Legacy token validation
428
434
  try {
429
435
  const isValid = await this.validate();
@@ -444,11 +450,11 @@ export class AuthService extends OxyServices {
444
450
  user
445
451
  };
446
452
  } catch (validationError) {
447
- return {
448
- valid: false,
453
+ return {
454
+ valid: false,
449
455
  userId,
450
456
  error: 'Token validation failed'
451
- };
457
+ };
452
458
  }
453
459
  }
454
460
  } catch (error) {
@@ -464,7 +470,7 @@ export class AuthService extends OxyServices {
464
470
  */
465
471
  async getDeviceSessions(sessionId: string): Promise<any[]> {
466
472
  try {
467
- const res = await this.getClient().get(`/session/device/sessions/${sessionId}`);
473
+ const res = await this.getClient().get(`/api/session/device/sessions/${sessionId}`);
468
474
  return res.data;
469
475
  } catch (error) {
470
476
  throw this.handleError(error);
@@ -476,7 +482,7 @@ export class AuthService extends OxyServices {
476
482
  */
477
483
  async logoutAllDeviceSessions(sessionId: string): Promise<void> {
478
484
  try {
479
- await this.getClient().delete(`/session/device/logout-all/${sessionId}`);
485
+ await this.getClient().delete(`/api/session/device/logout-all/${sessionId}`);
480
486
  } catch (error) {
481
487
  throw this.handleError(error);
482
488
  }
@@ -487,42 +493,56 @@ export class AuthService extends OxyServices {
487
493
  */
488
494
  async updateDeviceName(sessionId: string, deviceName: string): Promise<void> {
489
495
  try {
490
- await this.getClient().put(`/session/device/name/${sessionId}`, { deviceName });
496
+ await this.getClient().put(`/api/session/device/name/${sessionId}`, { deviceName });
491
497
  } catch (error) {
492
498
  throw this.handleError(error);
493
499
  }
494
500
  }
495
501
 
496
502
  /**
497
- * Check username availability by trying to get profile
498
- * Note: This method uses the profiles endpoint to check if username exists
503
+ * Check username availability
499
504
  */
500
505
  async checkUsernameAvailability(username: string): Promise<{ available: boolean; message: string }> {
501
506
  try {
502
- // Try to get profile by username - if it exists, username is not available
503
- await this.getClient().get(`/profiles/username/${username}`);
504
- return { available: false, message: 'Username is already taken' };
507
+ const res = await this.getClient().get(`/api/auth/check-username/${username}`);
508
+ return res.data;
505
509
  } catch (error: any) {
506
- // If profile not found (404), username is available
510
+ // If the endpoint doesn't exist, fall back to basic validation
507
511
  if (error.response?.status === 404) {
508
- return { available: true, message: 'Username is available' };
512
+ console.warn('Username validation endpoint not found, using fallback validation');
513
+ return { available: true, message: 'Username validation not available' };
514
+ }
515
+
516
+ // If it's a validation error (400), return the error message
517
+ if (error.response?.status === 400) {
518
+ return { available: false, message: error.response.data.message || 'Username not available' };
509
519
  }
510
520
 
511
- // For other errors, assume available to avoid blocking registration
512
- console.warn('Username validation error, assuming available:', error);
513
- return { available: true, message: 'Username validation not available' };
521
+ throw this.handleError(error);
514
522
  }
515
523
  }
516
524
 
517
525
  /**
518
526
  * Check email availability
519
- * Note: This method is not supported by the current API
520
527
  */
521
528
  async checkEmailAvailability(email: string): Promise<{ available: boolean; message: string }> {
522
- // Email validation is not supported by the current API
523
- // Return available to avoid blocking registration
524
- console.warn('Email validation not supported by API, assuming available');
525
- return { available: true, message: 'Email validation not available' };
529
+ try {
530
+ const res = await this.getClient().get(`/api/auth/check-email/${email}`);
531
+ return res.data;
532
+ } catch (error: any) {
533
+ // If the endpoint doesn't exist, fall back to basic validation
534
+ if (error.response?.status === 404) {
535
+ console.warn('Email validation endpoint not found, using fallback validation');
536
+ return { available: true, message: 'Email validation not available' };
537
+ }
538
+
539
+ // If it's a validation error (400), return the error message
540
+ if (error.response?.status === 400) {
541
+ return { available: false, message: error.response.data.message || 'Email not available' };
542
+ }
543
+
544
+ throw this.handleError(error);
545
+ }
526
546
  }
527
547
 
528
548
  // Note: getUserById and getUserProfileByUsername methods have been moved to UserService
@@ -19,7 +19,7 @@ export class DeviceService extends OxyServices {
19
19
  const params = { deviceId };
20
20
  const searchParams = buildSearchParams(params);
21
21
 
22
- const res = await this.getClient().get(`/session/device/sessions/${sessionId}?${searchParams.toString()}`);
22
+ const res = await this.getClient().get(`/api/session/device/sessions/${sessionId}?${searchParams.toString()}`);
23
23
  return res.data;
24
24
  } catch (error) {
25
25
  throw this.handleError(error);
@@ -34,7 +34,7 @@ export class DeviceService extends OxyServices {
34
34
  const params = { deviceId, excludeCurrent };
35
35
  const searchParams = buildSearchParams(params);
36
36
 
37
- const res = await this.getClient().post(`/session/device/logout-all/${sessionId}?${searchParams.toString()}`);
37
+ const res = await this.getClient().post(`/api/session/device/logout-all/${sessionId}?${searchParams.toString()}`);
38
38
  return res.data;
39
39
  } catch (error) {
40
40
  throw this.handleError(error);
@@ -46,7 +46,7 @@ export class DeviceService extends OxyServices {
46
46
  */
47
47
  async updateDeviceName(sessionId: string, deviceName: string): Promise<UpdateDeviceNameResponse> {
48
48
  try {
49
- const res = await this.getClient().put(`/session/device/name/${sessionId}`, { deviceName });
49
+ const res = await this.getClient().put(`/api/session/device/name/${sessionId}`, { deviceName });
50
50
  return res.data;
51
51
  } catch (error) {
52
52
  throw this.handleError(error);
@@ -80,7 +80,7 @@ export class FileService extends OxyServices {
80
80
  */
81
81
  async getFileMetadata(fileId: string): Promise<FileMetadata> {
82
82
  try {
83
- const res = await this.getClient().get(`/files/meta/${fileId}`);
83
+ const res = await this.getClient().get(`/api/files/meta/${fileId}`);
84
84
  return res.data;
85
85
  } catch (error) {
86
86
  throw this.handleError(error);
@@ -92,7 +92,7 @@ export class FileService extends OxyServices {
92
92
  */
93
93
  async updateFileMetadata(fileId: string, updates: FileUpdateRequest): Promise<FileMetadata> {
94
94
  try {
95
- const res = await this.getClient().put(`/files/meta/${fileId}`, updates);
95
+ const res = await this.getClient().put(`/api/files/meta/${fileId}`, updates);
96
96
  return res.data;
97
97
  } catch (error) {
98
98
  throw this.handleError(error);
@@ -104,7 +104,7 @@ export class FileService extends OxyServices {
104
104
  */
105
105
  async deleteFile(fileId: string): Promise<FileDeleteResponse> {
106
106
  try {
107
- const res = await this.getClient().delete(`/files/${fileId}`);
107
+ const res = await this.getClient().delete(`/api/files/${fileId}`);
108
108
  return res.data;
109
109
  } catch (error) {
110
110
  throw this.handleError(error);
@@ -145,7 +145,7 @@ export class FileService extends OxyServices {
145
145
  });
146
146
  }
147
147
 
148
- const res = await this.getClient().get(`/files/list/${userId}?${params.toString()}`);
148
+ const res = await this.getClient().get(`/api/files/list/${userId}?${params.toString()}`);
149
149
  return res.data;
150
150
  } catch (error) {
151
151
  throw this.handleError(error);
@@ -157,7 +157,7 @@ export class FileService extends OxyServices {
157
157
  */
158
158
  async downloadFileContent(fileId: string): Promise<Response> {
159
159
  try {
160
- const res = await this.getClient().get(`/files/${fileId}`, {
160
+ const res = await this.getClient().get(`/api/files/${fileId}`, {
161
161
  responseType: 'blob'
162
162
  });
163
163
  return res.data;
@@ -171,7 +171,7 @@ export class FileService extends OxyServices {
171
171
  */
172
172
  async getFileContentAsText(fileId: string): Promise<string> {
173
173
  try {
174
- const res = await this.getClient().get(`/files/${fileId}`, {
174
+ const res = await this.getClient().get(`/api/files/${fileId}`, {
175
175
  headers: {
176
176
  'Accept': 'text/plain'
177
177
  }
@@ -187,7 +187,7 @@ export class FileService extends OxyServices {
187
187
  */
188
188
  async getFileContentAsBlob(fileId: string): Promise<Blob> {
189
189
  try {
190
- const res = await this.getClient().get(`/files/${fileId}`, {
190
+ const res = await this.getClient().get(`/api/files/${fileId}`, {
191
191
  responseType: 'blob'
192
192
  });
193
193
  return res.data;
@@ -39,7 +39,7 @@ export class KarmaService extends OxyServices {
39
39
  */
40
40
  async getUserKarmaTotal(userId: string): Promise<{ total: number }> {
41
41
  try {
42
- const res = await this.getClient().get(`/karma/${userId}/total`);
42
+ const res = await this.getClient().get(`/api/karma/${userId}/total`);
43
43
  return res.data;
44
44
  } catch (error) {
45
45
  throw this.handleError(error);
@@ -59,7 +59,7 @@ export class KarmaService extends OxyServices {
59
59
  if (limit) params.append('limit', limit.toString());
60
60
  if (offset) params.append('offset', offset.toString());
61
61
 
62
- const res = await this.getClient().get(`/karma/${userId}/history?${params.toString()}`);
62
+ const res = await this.getClient().get(`/api/karma/${userId}/history?${params.toString()}`);
63
63
  return res.data;
64
64
  } catch (error) {
65
65
  throw this.handleError(error);
@@ -18,7 +18,7 @@ export class LocationService extends OxyServices {
18
18
  params.append('countrycodes', countrycodes);
19
19
  }
20
20
 
21
- const res = await this.getClient().get(`/location-search/search?${params.toString()}`);
21
+ const res = await this.getClient().get(`/api/location-search/search?${params.toString()}`);
22
22
  return res.data;
23
23
  } catch (error) {
24
24
  throw this.handleError(error);
@@ -30,7 +30,7 @@ export class LocationService extends OxyServices {
30
30
  */
31
31
  async getLocationDetails(lat: number, lon: number): Promise<any> {
32
32
  try {
33
- const res = await this.getClient().get(`/location-search/reverse?lat=${lat}&lon=${lon}`);
33
+ const res = await this.getClient().get(`/api/location-search/reverse?lat=${lat}&lon=${lon}`);
34
34
  return res.data;
35
35
  } catch (error) {
36
36
  throw this.handleError(error);
@@ -56,7 +56,7 @@ export class LocationService extends OxyServices {
56
56
  skip: skip.toString()
57
57
  });
58
58
 
59
- const res = await this.getClient().get(`/location-search/near?${params.toString()}`);
59
+ const res = await this.getClient().get(`/api/location-search/near?${params.toString()}`);
60
60
  return res.data;
61
61
  } catch (error) {
62
62
  throw this.handleError(error);
@@ -84,7 +84,7 @@ export class LocationService extends OxyServices {
84
84
  if (country) params.append('country', country);
85
85
  if (city) params.append('city', city);
86
86
 
87
- const res = await this.getClient().get(`/location-search/db-search?${params.toString()}`);
87
+ const res = await this.getClient().get(`/api/location-search/db-search?${params.toString()}`);
88
88
  return res.data;
89
89
  } catch (error) {
90
90
  throw this.handleError(error);
@@ -44,7 +44,7 @@ export class PaymentService extends OxyServices {
44
44
  */
45
45
  async getPaymentMethods(userId: string): Promise<PaymentMethod[]> {
46
46
  try {
47
- const res = await this.getClient().get(`/payments/methods/${userId}`);
47
+ const res = await this.getClient().get(`/api/payments/methods/${userId}`);
48
48
  return res.data;
49
49
  } catch (error) {
50
50
  throw this.handleError(error);
@@ -56,7 +56,7 @@ export class PaymentService extends OxyServices {
56
56
  */
57
57
  async getWallet(userId: string): Promise<Wallet> {
58
58
  try {
59
- const res = await this.getClient().get(`/wallet/${userId}`);
59
+ const res = await this.getClient().get(`/api/wallet/${userId}`);
60
60
  return res.data;
61
61
  } catch (error) {
62
62
  throw this.handleError(error);
@@ -76,7 +76,7 @@ export class PaymentService extends OxyServices {
76
76
  if (limit) params.append('limit', limit.toString());
77
77
  if (offset) params.append('offset', offset.toString());
78
78
 
79
- const res = await this.getClient().get(`/wallet/${userId}/transactions?${params.toString()}`);
79
+ const res = await this.getClient().get(`/api/wallet/${userId}/transactions?${params.toString()}`);
80
80
  return res.data;
81
81
  } catch (error) {
82
82
  throw this.handleError(error);
@@ -88,7 +88,7 @@ export class PaymentService extends OxyServices {
88
88
  */
89
89
  async getTransaction(transactionId: string): Promise<Transaction> {
90
90
  try {
91
- const res = await this.getClient().get(`/transactions/${transactionId}`);
91
+ const res = await this.getClient().get(`/api/transactions/${transactionId}`);
92
92
  return res.data;
93
93
  } catch (error) {
94
94
  throw this.handleError(error);
@@ -11,7 +11,7 @@ export class UserService extends OxyServices {
11
11
  */
12
12
  async getProfileByUsername(username: string): Promise<User> {
13
13
  try {
14
- const res = await this.getClient().get(`/profiles/username/${username}`);
14
+ const res = await this.getClient().get(`/api/profiles/username/${username}`);
15
15
  return res.data;
16
16
  } catch (error) {
17
17
  throw this.handleError(error);
@@ -26,7 +26,7 @@ export class UserService extends OxyServices {
26
26
  const params = { query, ...pagination };
27
27
  const searchParams = buildSearchParams(params);
28
28
 
29
- const res = await this.getClient().get(`/profiles/search?${searchParams.toString()}`);
29
+ const res = await this.getClient().get(`/api/profiles/search?${searchParams.toString()}`);
30
30
  return res.data;
31
31
  } catch (error) {
32
32
  throw this.handleError(error);
@@ -45,7 +45,7 @@ export class UserService extends OxyServices {
45
45
  [key: string]: any;
46
46
  }>> {
47
47
  try {
48
- const res = await this.getClient().get('/profiles/recommendations');
48
+ const res = await this.getClient().get('/api/profiles/recommendations');
49
49
  return res.data;
50
50
  } catch (error) {
51
51
  throw this.handleError(error);
@@ -57,7 +57,7 @@ export class UserService extends OxyServices {
57
57
  */
58
58
  async getUserById(userId: string): Promise<User> {
59
59
  try {
60
- const res = await this.getClient().get(`/users/${userId}`);
60
+ const res = await this.getClient().get(`/api/users/${userId}`);
61
61
  return res.data;
62
62
  } catch (error) {
63
63
  throw this.handleError(error);
@@ -69,7 +69,7 @@ export class UserService extends OxyServices {
69
69
  */
70
70
  async getCurrentUser(): Promise<User> {
71
71
  try {
72
- const res = await this.getClient().get('/users/me');
72
+ const res = await this.getClient().get('/api/users/me');
73
73
  return res.data;
74
74
  } catch (error) {
75
75
  throw this.handleError(error);
@@ -81,7 +81,7 @@ export class UserService extends OxyServices {
81
81
  */
82
82
  async updateProfile(updates: Record<string, any>): Promise<User> {
83
83
  try {
84
- const res = await this.getClient().put('/users/me', updates);
84
+ const res = await this.getClient().put('/api/users/me', updates);
85
85
  return res.data;
86
86
  } catch (error) {
87
87
  throw this.handleError(error);
@@ -93,7 +93,7 @@ export class UserService extends OxyServices {
93
93
  */
94
94
  async updateUser(userId: string, updates: Record<string, any>): Promise<User> {
95
95
  try {
96
- const res = await this.getClient().put(`/users/${userId}`, updates);
96
+ const res = await this.getClient().put(`/api/users/${userId}`, updates);
97
97
  return res.data;
98
98
  } catch (error) {
99
99
  throw this.handleError(error);
@@ -105,7 +105,7 @@ export class UserService extends OxyServices {
105
105
  */
106
106
  async followUser(userId: string): Promise<{ success: boolean; message: string }> {
107
107
  try {
108
- const res = await this.getClient().post(`/users/${userId}/follow`);
108
+ const res = await this.getClient().post(`/api/users/${userId}/follow`);
109
109
  return res.data;
110
110
  } catch (error) {
111
111
  throw this.handleError(error);
@@ -117,7 +117,7 @@ export class UserService extends OxyServices {
117
117
  */
118
118
  async unfollowUser(userId: string): Promise<{ success: boolean; message: string }> {
119
119
  try {
120
- const res = await this.getClient().delete(`/users/${userId}/follow`);
120
+ const res = await this.getClient().delete(`/api/users/${userId}/follow`);
121
121
  return res.data;
122
122
  } catch (error) {
123
123
  throw this.handleError(error);
@@ -129,7 +129,7 @@ export class UserService extends OxyServices {
129
129
  */
130
130
  async getFollowStatus(userId: string): Promise<{ isFollowing: boolean }> {
131
131
  try {
132
- const res = await this.getClient().get(`/users/${userId}/follow-status`);
132
+ const res = await this.getClient().get(`/api/users/${userId}/following-status`);
133
133
  return res.data;
134
134
  } catch (error) {
135
135
  throw this.handleError(error);
@@ -146,7 +146,7 @@ export class UserService extends OxyServices {
146
146
  try {
147
147
  const searchParams = buildPaginationParams(pagination || {});
148
148
 
149
- const res = await this.getClient().get(`/users/${userId}/followers?${searchParams.toString()}`);
149
+ const res = await this.getClient().get(`/api/users/${userId}/followers?${searchParams.toString()}`);
150
150
  return res.data;
151
151
  } catch (error) {
152
152
  throw this.handleError(error);
@@ -163,7 +163,7 @@ export class UserService extends OxyServices {
163
163
  try {
164
164
  const searchParams = buildPaginationParams(pagination || {});
165
165
 
166
- const res = await this.getClient().get(`/users/${userId}/following?${searchParams.toString()}`);
166
+ const res = await this.getClient().get(`/api/users/${userId}/following?${searchParams.toString()}`);
167
167
  return res.data;
168
168
  } catch (error) {
169
169
  throw this.handleError(error);
@@ -175,7 +175,7 @@ export class UserService extends OxyServices {
175
175
  */
176
176
  async getNotifications(): Promise<Notification[]> {
177
177
  try {
178
- const res = await this.getClient().get('/notifications');
178
+ const res = await this.getClient().get('/api/notifications');
179
179
  return res.data;
180
180
  } catch (error) {
181
181
  throw this.handleError(error);
@@ -187,7 +187,7 @@ export class UserService extends OxyServices {
187
187
  */
188
188
  async getUnreadCount(): Promise<number> {
189
189
  try {
190
- const res = await this.getClient().get('/notifications/unread-count');
190
+ const res = await this.getClient().get('/api/notifications/unread-count');
191
191
  return res.data.count;
192
192
  } catch (error) {
193
193
  throw this.handleError(error);
@@ -199,7 +199,7 @@ export class UserService extends OxyServices {
199
199
  */
200
200
  async createNotification(data: Partial<Notification>): Promise<Notification> {
201
201
  try {
202
- const res = await this.getClient().post('/notifications', data);
202
+ const res = await this.getClient().post('/api/notifications', data);
203
203
  return res.data;
204
204
  } catch (error) {
205
205
  throw this.handleError(error);
@@ -211,7 +211,7 @@ export class UserService extends OxyServices {
211
211
  */
212
212
  async markNotificationAsRead(notificationId: string): Promise<void> {
213
213
  try {
214
- await this.getClient().put(`/notifications/${notificationId}/read`);
214
+ await this.getClient().put(`/api/notifications/${notificationId}/read`);
215
215
  } catch (error) {
216
216
  throw this.handleError(error);
217
217
  }
@@ -222,7 +222,7 @@ export class UserService extends OxyServices {
222
222
  */
223
223
  async markAllNotificationsAsRead(): Promise<void> {
224
224
  try {
225
- await this.getClient().put('/notifications/read-all');
225
+ await this.getClient().put('/api/notifications/read-all');
226
226
  } catch (error) {
227
227
  throw this.handleError(error);
228
228
  }
@@ -233,7 +233,7 @@ export class UserService extends OxyServices {
233
233
  */
234
234
  async deleteNotification(notificationId: string): Promise<void> {
235
235
  try {
236
- await this.getClient().delete(`/notifications/${notificationId}`);
236
+ await this.getClient().delete(`/api/notifications/${notificationId}`);
237
237
  } catch (error) {
238
238
  throw this.handleError(error);
239
239
  }