@dapex-tech/elite-online-services 0.0.5 → 0.0.6

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.
@@ -10,7 +10,7 @@ export type AdminDto = {
10
10
  /**
11
11
  * Admin Phone Number
12
12
  */
13
- phone: string;
13
+ phone?: string;
14
14
  /**
15
15
  * Admin Email
16
16
  */
@@ -0,0 +1,26 @@
1
+ export type AdminUpdateDto = {
2
+ /**
3
+ * Admin First Name
4
+ */
5
+ first_name?: string;
6
+ /**
7
+ * Admin Last Name
8
+ */
9
+ last_name?: string;
10
+ /**
11
+ * Admin Phone Number
12
+ */
13
+ phone?: string;
14
+ /**
15
+ * Admin Email
16
+ */
17
+ email?: string;
18
+ /**
19
+ * Admin Password
20
+ */
21
+ password?: string;
22
+ /**
23
+ * Admin Role ID
24
+ */
25
+ role_id?: number;
26
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,15 +8,15 @@ export type DriverDto = {
8
8
  */
9
9
  last_name: string;
10
10
  /**
11
- * Driver Phone Number (10 dígitos)
11
+ * Driver Phone Number (10 digits)
12
12
  */
13
- phone: string;
13
+ phone?: string;
14
14
  /**
15
15
  * Driver Email
16
16
  */
17
17
  email: string;
18
18
  /**
19
- * Driver Password (6-20 caracteres)
19
+ * Driver Password (6-20 characters)
20
20
  */
21
21
  password: string;
22
22
  /**
@@ -28,9 +28,9 @@ export type DriverDto = {
28
28
  */
29
29
  type: string;
30
30
  /**
31
- * Driver State (activo/inactivo)
31
+ * Driver Status (active/inactive)
32
32
  */
33
- state?: boolean;
33
+ status?: boolean;
34
34
  /**
35
35
  * Last Location
36
36
  */
@@ -0,0 +1,42 @@
1
+ export type DriverUpdateDto = {
2
+ /**
3
+ * Driver First Name
4
+ */
5
+ first_name?: string;
6
+ /**
7
+ * Driver Last Name
8
+ */
9
+ last_name?: string;
10
+ /**
11
+ * Driver Phone Number (10 digits)
12
+ */
13
+ phone?: string;
14
+ /**
15
+ * Driver Email
16
+ */
17
+ email?: string;
18
+ /**
19
+ * Driver Password (6-20 characters)
20
+ */
21
+ password?: string;
22
+ /**
23
+ * Driver License Number
24
+ */
25
+ license?: string;
26
+ /**
27
+ * Driver Type (e.g., internal, external)
28
+ */
29
+ type?: string;
30
+ /**
31
+ * Driver Status (active/inactive)
32
+ */
33
+ status?: boolean;
34
+ /**
35
+ * Last Location
36
+ */
37
+ last_location?: string;
38
+ /**
39
+ * Last Heartbeat
40
+ */
41
+ last_heartbeat?: string;
42
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ export type OrderDto = {
2
+ /**
3
+ * Column to sort by
4
+ */
5
+ column?: string;
6
+ /**
7
+ * Sort direction
8
+ */
9
+ type?: OrderDto.type;
10
+ };
11
+ export declare namespace OrderDto {
12
+ /**
13
+ * Sort direction
14
+ */
15
+ enum type {
16
+ ASC = "asc",
17
+ DESC = "desc"
18
+ }
19
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrderDto = void 0;
4
+ var OrderDto;
5
+ (function (OrderDto) {
6
+ /**
7
+ * Sort direction
8
+ */
9
+ let type;
10
+ (function (type) {
11
+ type["ASC"] = "asc";
12
+ type["DESC"] = "desc";
13
+ })(type = OrderDto.type || (OrderDto.type = {}));
14
+ })(OrderDto || (exports.OrderDto = OrderDto = {}));
@@ -18,5 +18,5 @@ export type UserDto = {
18
18
  /**
19
19
  * User Phone Number
20
20
  */
21
- phone: string;
21
+ phone?: string;
22
22
  };
@@ -0,0 +1,22 @@
1
+ export type UserUpdatedDto = {
2
+ /**
3
+ * User First Name
4
+ */
5
+ first_name: string;
6
+ /**
7
+ * User Last Name
8
+ */
9
+ last_name: string;
10
+ /**
11
+ * User Email
12
+ */
13
+ email: string;
14
+ /**
15
+ * User Password
16
+ */
17
+ password: string;
18
+ /**
19
+ * User Phone Number
20
+ */
21
+ phone?: string;
22
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/models/index.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  export * from './AdminDto';
2
+ export * from './AdminUpdateDto';
2
3
  export * from './DriverDto';
4
+ export * from './DriverUpdateDto';
3
5
  export * from './LoginDto';
6
+ export * from './OrderDto';
4
7
  export * from './UserDto';
8
+ export * from './UserUpdatedDto';
package/models/index.js CHANGED
@@ -15,6 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./AdminDto"), exports);
18
+ __exportStar(require("./AdminUpdateDto"), exports);
18
19
  __exportStar(require("./DriverDto"), exports);
20
+ __exportStar(require("./DriverUpdateDto"), exports);
19
21
  __exportStar(require("./LoginDto"), exports);
22
+ __exportStar(require("./OrderDto"), exports);
20
23
  __exportStar(require("./UserDto"), exports);
24
+ __exportStar(require("./UserUpdatedDto"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dapex-tech/elite-online-services",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "private": false,
@@ -1,4 +1,6 @@
1
1
  import type { AdminDto } from '../models/AdminDto';
2
+ import type { AdminUpdateDto } from '../models/AdminUpdateDto';
3
+ import type { OrderDto } from '../models/OrderDto';
2
4
  import type { CancelablePromise } from '../core/CancelablePromise';
3
5
  export declare class AdminService {
4
6
  /**
@@ -10,20 +12,19 @@ export declare class AdminService {
10
12
  static create(requestBody: AdminDto): CancelablePromise<any>;
11
13
  /**
12
14
  * Get all admins
13
- * @param search
14
- * @param orderBy
15
- * @param order
15
+ * @param search Text to search for in name, surname, phone number or email
16
+ * @param order Sorting options
16
17
  * @returns any List of admins
17
18
  * @throws ApiError
18
19
  */
19
- static findAll(search: string, orderBy: string, order: string): CancelablePromise<any>;
20
+ static findAll(search?: string, order?: OrderDto): CancelablePromise<any>;
20
21
  /**
21
22
  * Get a single admin by ID
22
23
  * @param id
23
24
  * @returns any Admin found
24
25
  * @throws ApiError
25
26
  */
26
- static findOne(id: number): CancelablePromise<any>;
27
+ static findById(id: number): CancelablePromise<any>;
27
28
  /**
28
29
  * Update an admin by ID
29
30
  * @param id
@@ -31,7 +32,7 @@ export declare class AdminService {
31
32
  * @returns any Admin updated successfully.
32
33
  * @throws ApiError
33
34
  */
34
- static update(id: number, requestBody: AdminDto): CancelablePromise<any>;
35
+ static update(id: number, requestBody: AdminUpdateDto): CancelablePromise<any>;
35
36
  /**
36
37
  * Delete an admin by ID
37
38
  * @param id
@@ -23,19 +23,17 @@ class AdminService {
23
23
  }
24
24
  /**
25
25
  * Get all admins
26
- * @param search
27
- * @param orderBy
28
- * @param order
26
+ * @param search Text to search for in name, surname, phone number or email
27
+ * @param order Sorting options
29
28
  * @returns any List of admins
30
29
  * @throws ApiError
31
30
  */
32
- static findAll(search, orderBy, order) {
31
+ static findAll(search, order) {
33
32
  return (0, request_1.request)(OpenAPI_1.OpenAPI, {
34
33
  method: 'GET',
35
34
  url: '/admins',
36
35
  query: {
37
36
  'search': search,
38
- 'orderBy': orderBy,
39
37
  'order': order,
40
38
  },
41
39
  errors: {
@@ -49,7 +47,7 @@ class AdminService {
49
47
  * @returns any Admin found
50
48
  * @throws ApiError
51
49
  */
52
- static findOne(id) {
50
+ static findById(id) {
53
51
  return (0, request_1.request)(OpenAPI_1.OpenAPI, {
54
52
  method: 'GET',
55
53
  url: '/admins/{id}',
@@ -71,7 +69,7 @@ class AdminService {
71
69
  */
72
70
  static update(id, requestBody) {
73
71
  return (0, request_1.request)(OpenAPI_1.OpenAPI, {
74
- method: 'PUT',
72
+ method: 'PATCH',
75
73
  url: '/admins/{id}',
76
74
  path: {
77
75
  'id': id,
@@ -1,4 +1,6 @@
1
1
  import type { DriverDto } from '../models/DriverDto';
2
+ import type { DriverUpdateDto } from '../models/DriverUpdateDto';
3
+ import type { OrderDto } from '../models/OrderDto';
2
4
  import type { CancelablePromise } from '../core/CancelablePromise';
3
5
  export declare class DriversService {
4
6
  /**
@@ -10,20 +12,19 @@ export declare class DriversService {
10
12
  static create(requestBody: DriverDto): CancelablePromise<any>;
11
13
  /**
12
14
  * Get all drivers
13
- * @param search
14
- * @param orderBy
15
- * @param order
15
+ * @param search Text to search for in name, surname, phone number, license or type
16
+ * @param order Sorting options
16
17
  * @returns any List of drivers
17
18
  * @throws ApiError
18
19
  */
19
- static findAll(search: string, orderBy: string, order: string): CancelablePromise<any>;
20
+ static findAll(search?: string, order?: OrderDto): CancelablePromise<any>;
20
21
  /**
21
22
  * Get a single driver by ID
22
23
  * @param id
23
24
  * @returns any Driver found
24
25
  * @throws ApiError
25
26
  */
26
- static findOne(id: number): CancelablePromise<any>;
27
+ static findById(id: number): CancelablePromise<any>;
27
28
  /**
28
29
  * Update a driver by ID
29
30
  * @param id
@@ -31,7 +32,7 @@ export declare class DriversService {
31
32
  * @returns any Driver updated successfully.
32
33
  * @throws ApiError
33
34
  */
34
- static update(id: number, requestBody: DriverDto): CancelablePromise<any>;
35
+ static update(id: number, requestBody: DriverUpdateDto): CancelablePromise<any>;
35
36
  /**
36
37
  * Delete a driver by ID
37
38
  * @param id
@@ -23,19 +23,17 @@ class DriversService {
23
23
  }
24
24
  /**
25
25
  * Get all drivers
26
- * @param search
27
- * @param orderBy
28
- * @param order
26
+ * @param search Text to search for in name, surname, phone number, license or type
27
+ * @param order Sorting options
29
28
  * @returns any List of drivers
30
29
  * @throws ApiError
31
30
  */
32
- static findAll(search, orderBy, order) {
31
+ static findAll(search, order) {
33
32
  return (0, request_1.request)(OpenAPI_1.OpenAPI, {
34
33
  method: 'GET',
35
34
  url: '/drivers',
36
35
  query: {
37
36
  'search': search,
38
- 'orderBy': orderBy,
39
37
  'order': order,
40
38
  },
41
39
  errors: {
@@ -49,7 +47,7 @@ class DriversService {
49
47
  * @returns any Driver found
50
48
  * @throws ApiError
51
49
  */
52
- static findOne(id) {
50
+ static findById(id) {
53
51
  return (0, request_1.request)(OpenAPI_1.OpenAPI, {
54
52
  method: 'GET',
55
53
  url: '/drivers/{id}',
@@ -71,7 +69,7 @@ class DriversService {
71
69
  */
72
70
  static update(id, requestBody) {
73
71
  return (0, request_1.request)(OpenAPI_1.OpenAPI, {
74
- method: 'PUT',
72
+ method: 'PATCH',
75
73
  url: '/drivers/{id}',
76
74
  path: {
77
75
  'id': id,
@@ -1,4 +1,5 @@
1
1
  import type { LoginDto } from '../models/LoginDto';
2
+ import type { UserDto } from '../models/UserDto';
2
3
  import type { CancelablePromise } from '../core/CancelablePromise';
3
4
  export declare class LoginsService {
4
5
  /**
@@ -8,6 +9,23 @@ export declare class LoginsService {
8
9
  * @throws ApiError
9
10
  */
10
11
  static login(requestBody: LoginDto): CancelablePromise<any>;
12
+ /**
13
+ * User Register
14
+ * @param requestBody
15
+ * @returns any Registration successful
16
+ * @throws ApiError
17
+ */
18
+ static register(requestBody: UserDto): CancelablePromise<any>;
19
+ /**
20
+ * @returns any
21
+ * @throws ApiError
22
+ */
23
+ static refreshToken(): CancelablePromise<any>;
24
+ /**
25
+ * @returns any
26
+ * @throws ApiError
27
+ */
28
+ static me(): CancelablePromise<any>;
11
29
  /**
12
30
  * Admin Login
13
31
  * @param requestBody
@@ -21,6 +21,43 @@ class LoginsService {
21
21
  },
22
22
  });
23
23
  }
24
+ /**
25
+ * User Register
26
+ * @param requestBody
27
+ * @returns any Registration successful
28
+ * @throws ApiError
29
+ */
30
+ static register(requestBody) {
31
+ return (0, request_1.request)(OpenAPI_1.OpenAPI, {
32
+ method: 'POST',
33
+ url: '/auth/users/register',
34
+ body: requestBody,
35
+ mediaType: 'application/json',
36
+ errors: {
37
+ 400: `Bad Request`,
38
+ },
39
+ });
40
+ }
41
+ /**
42
+ * @returns any
43
+ * @throws ApiError
44
+ */
45
+ static refreshToken() {
46
+ return (0, request_1.request)(OpenAPI_1.OpenAPI, {
47
+ method: 'GET',
48
+ url: '/auth/users/refresh-token',
49
+ });
50
+ }
51
+ /**
52
+ * @returns any
53
+ * @throws ApiError
54
+ */
55
+ static me() {
56
+ return (0, request_1.request)(OpenAPI_1.OpenAPI, {
57
+ method: 'GET',
58
+ url: '/auth/users/me',
59
+ });
60
+ }
24
61
  /**
25
62
  * Admin Login
26
63
  * @param requestBody
@@ -1,4 +1,6 @@
1
+ import type { OrderDto } from '../models/OrderDto';
1
2
  import type { UserDto } from '../models/UserDto';
3
+ import type { UserUpdatedDto } from '../models/UserUpdatedDto';
2
4
  import type { CancelablePromise } from '../core/CancelablePromise';
3
5
  export declare class UsersService {
4
6
  /**
@@ -10,13 +12,12 @@ export declare class UsersService {
10
12
  static create(requestBody: UserDto): CancelablePromise<any>;
11
13
  /**
12
14
  * Get all users
13
- * @param search
14
- * @param orderBy
15
- * @param order
15
+ * @param search Text to search for in name, surname, phone number or email
16
+ * @param order Sorting options
16
17
  * @returns any List of users.
17
18
  * @throws ApiError
18
19
  */
19
- static findAll(search: string, orderBy: string, order: string): CancelablePromise<any>;
20
+ static findAll(search?: string, order?: OrderDto): CancelablePromise<any>;
20
21
  /**
21
22
  * Get a user by ID
22
23
  * @param id
@@ -31,7 +32,7 @@ export declare class UsersService {
31
32
  * @returns any User updated successfully.
32
33
  * @throws ApiError
33
34
  */
34
- static update(id: number, requestBody: UserDto): CancelablePromise<any>;
35
+ static update(id: number, requestBody: UserUpdatedDto): CancelablePromise<any>;
35
36
  /**
36
37
  * Delete a user by ID
37
38
  * @param id
@@ -24,19 +24,17 @@ class UsersService {
24
24
  }
25
25
  /**
26
26
  * Get all users
27
- * @param search
28
- * @param orderBy
29
- * @param order
27
+ * @param search Text to search for in name, surname, phone number or email
28
+ * @param order Sorting options
30
29
  * @returns any List of users.
31
30
  * @throws ApiError
32
31
  */
33
- static findAll(search, orderBy, order) {
32
+ static findAll(search, order) {
34
33
  return (0, request_1.request)(OpenAPI_1.OpenAPI, {
35
34
  method: 'GET',
36
35
  url: '/users',
37
36
  query: {
38
37
  'search': search,
39
- 'orderBy': orderBy,
40
38
  'order': order,
41
39
  },
42
40
  errors: {
@@ -72,7 +70,7 @@ class UsersService {
72
70
  */
73
71
  static update(id, requestBody) {
74
72
  return (0, request_1.request)(OpenAPI_1.OpenAPI, {
75
- method: 'PUT',
73
+ method: 'PATCH',
76
74
  url: '/users/{id}',
77
75
  path: {
78
76
  'id': id,
package/socketService.js CHANGED
@@ -1,99 +1,104 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.SocketService = void 0;
4
- const socket_io_client_1 = require("socket.io-client");
4
+ const socket_io_client_1 = require('socket.io-client');
5
5
  class SocketService {
6
- /*
6
+ /*
7
7
  constructor(baseUrl: string) {
8
8
  this.socket = io(baseUrl, { transports: ['websocket'] });
9
9
  }
10
10
  */
11
- constructor(baseUrl, token) {
12
- this.socket = (0, socket_io_client_1.io)(baseUrl, {
13
- transports: ['websocket'],
14
- auth: token ? { token } : undefined, // ✅ send token if available
15
- });
16
- }
17
- connect() {
18
- this.socket.connect();
19
- }
20
- disconnect() {
21
- this.socket.disconnect();
22
- }
23
- isConnected() {
24
- return this.socket.connected;
25
- }
26
- isActive() {
27
- return this.socket.active;
28
- }
29
- on(event, cb) {
30
- this.socket.on(event, cb);
31
- }
32
- off(event, cb) {
33
- if (cb) {
34
- this.socket.off(event, cb);
35
- }
36
- else {
37
- this.socket.removeAllListeners(event);
38
- }
39
- }
40
- emit(event, data) {
41
- this.socket.emit(event, data);
42
- }
43
- // Custom methods
44
- sendMessage(message) {
45
- this.emit('message', { text: message });
46
- }
47
- onMessageReceived(cb) {
48
- this.on('messageReceived', cb);
49
- }
50
- offMessageReceived(cb) {
51
- this.off('messageReceived', cb);
52
- }
53
- updateLocation(data) {
54
- this.emit('updateLocation', { ...data });
55
- }
56
- onLocationUpdated(cb) {
57
- this.on('locationUpdated', cb);
58
- }
59
- offLocationUpdated(cb) {
60
- this.off('locationUpdated', cb);
61
- }
62
- onAllLocations(cb) {
63
- this.on('allLocations', cb);
64
- }
65
- offAllLocations(cb) {
66
- this.off('allLocations', cb);
67
- }
68
- sendHeartbeat(clientID) {
69
- this.emit('heartbeat', { clientID });
70
- }
71
- onHeartbeatReceived(cb) {
72
- this.on('heartbeatReceived', cb);
73
- }
74
- offHeartbeatReceived(cb) {
75
- this.off('heartbeatReceived', cb);
76
- }
77
- onAllHeartbeats(cb) {
78
- this.on('allHeartbeats', cb);
79
- }
80
- offAllHeartbeats(cb) {
81
- this.off('allHeartbeats', cb);
82
- }
83
- updateServiceOrderStatus(orderID, status) {
84
- this.emit('serviceOrderStatusUpdate', { orderID, status });
85
- }
86
- onServiceOrderStatusUpdated(callback) {
87
- this.on('serviceOrderStatusUpdated', callback);
88
- }
89
- offServiceOrderStatusUpdated(callback) {
90
- this.off('serviceOrderStatusUpdated', callback);
91
- }
92
- onAllServiceOrderStatuses(callback) {
93
- this.on('allServiceOrderStatuses', callback);
94
- }
95
- offAllServiceOrderStatuses(callback) {
96
- this.off('allServiceOrderStatuses', callback);
97
- }
11
+ constructor(baseUrl, token) {
12
+ this.socket = (0, socket_io_client_1.io)(baseUrl, {
13
+ transports: ['websocket'],
14
+ auth: token ? { token } : undefined, // ✅ send token if available
15
+ });
16
+ }
17
+ connect() {
18
+ this.socket.connect();
19
+ }
20
+ disconnect() {
21
+ this.socket.disconnect();
22
+ }
23
+ isConnected() {
24
+ return this.socket.connected;
25
+ }
26
+ isActive() {
27
+ return this.socket.active;
28
+ }
29
+ on(event, cb) {
30
+ this.socket.on(event, cb);
31
+ }
32
+ off(event, cb) {
33
+ if (cb) {
34
+ this.socket.off(event, cb);
35
+ } else {
36
+ this.socket.removeAllListeners(event);
37
+ }
38
+ }
39
+ emit(event, data) {
40
+ this.socket.emit(event, data);
41
+ }
42
+ // Custom methods
43
+ sendMessage(message) {
44
+ this.emit('message', { text: message });
45
+ }
46
+ onMessageReceived(cb) {
47
+ this.on('messageReceived', cb);
48
+ }
49
+ offMessageReceived(cb) {
50
+ this.off('messageReceived', cb);
51
+ }
52
+ updateLocation(data) {
53
+ this.emit('updateLocation', { ...data });
54
+ }
55
+ onLocationUpdated(cb) {
56
+ this.on('locationUpdated', cb);
57
+ }
58
+ offLocationUpdated(cb) {
59
+ this.off('locationUpdated', cb);
60
+ }
61
+ onAllLocations(cb) {
62
+ this.on('allLocations', cb);
63
+ }
64
+ offAllLocations(cb) {
65
+ this.off('allLocations', cb);
66
+ }
67
+ sendHeartbeat(clientID) {
68
+ this.emit('heartbeat', { clientID });
69
+ }
70
+ onHeartbeatReceived(cb) {
71
+ this.on('heartbeatReceived', cb);
72
+ }
73
+ offHeartbeatReceived(cb) {
74
+ this.off('heartbeatReceived', cb);
75
+ }
76
+ onAllHeartbeats(cb) {
77
+ this.on('allHeartbeats', cb);
78
+ }
79
+ offAllHeartbeats(cb) {
80
+ this.off('allHeartbeats', cb);
81
+ }
82
+ updateServiceOrderStatus(orderID, status) {
83
+ this.emit('serviceOrderStatusUpdate', { orderID, status });
84
+ }
85
+ onServiceOrderStatusUpdated(callback) {
86
+ this.on('serviceOrderStatusUpdated', callback);
87
+ }
88
+ offServiceOrderStatusUpdated(callback) {
89
+ this.off('serviceOrderStatusUpdated', callback);
90
+ }
91
+ onAllServiceOrderStatuses(callback) {
92
+ this.on('allServiceOrderStatuses', callback);
93
+ }
94
+ offAllServiceOrderStatuses(callback) {
95
+ this.off('allServiceOrderStatuses', callback);
96
+ }
97
+ onConnected(callback) {
98
+ this.on('connected', callback);
99
+ }
100
+ offConnected(callback) {
101
+ this.off('connected', callback);
102
+ }
98
103
  }
99
104
  exports.SocketService = SocketService;