@azteam/express 1.2.235 → 1.2.238

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azteam/express",
3
- "version": "1.2.235",
3
+ "version": "1.2.238",
4
4
  "main": "src/index.js",
5
5
  "engines": {
6
6
  "node": ">= 12.0.0",
@@ -51,7 +51,7 @@ class AdminController extends Controller {
51
51
  'modified_at_start',
52
52
  'modified_at_end',
53
53
  ];
54
- this.paginateOptions.sortFields = [...this.paginateOptions.sortFields, 'status'];
54
+ this.paginateOptions.sortFields = [...this.paginateOptions.sortFields, 'created_at', 'modified_at', 'status'];
55
55
  }
56
56
  }
57
57
 
@@ -209,6 +209,25 @@ class AdminController extends Controller {
209
209
  };
210
210
  }
211
211
 
212
+ putModifyStatusWaitingPublic() {
213
+ return {
214
+ disabled: !this.roles.UPDATE,
215
+ path: '/waiting/:id',
216
+ method: [
217
+ adminRoleMiddleware([this.roles.UPDATE]),
218
+ validateMiddleware(REQUEST_TYPE.PARAMS, rulesId),
219
+ async (req, res) => {
220
+ const item = await this.repository.findOneById(req.params.id);
221
+ if (!item) return res.error(NOT_EXISTS);
222
+
223
+ await item.modifyStatusWaiting(req.body.message, req.user.id);
224
+
225
+ return res.success(item, this.guardResponse, this.allowResponse);
226
+ },
227
+ ],
228
+ };
229
+ }
230
+
212
231
  async afterDelete(item) {
213
232
  return item;
214
233
  }
package/src/Server.js CHANGED
@@ -262,11 +262,6 @@ class Server {
262
262
  device: req.get('X-DEVICE') || req.get('User-Agent'),
263
263
  device_id: req.get('X-DEVICE-ID') || 'web',
264
264
  os: req.get('X-OS') || 'web',
265
-
266
- 'x-forwarded-for': req.headers['x-forwarded-for'],
267
- 'x-real-ip': req.headers['x-real-ip'],
268
- 'req.socket.remoteAddress': req.socket.remoteAddress,
269
- 'req.connection.remoteAddress': req.connection.remoteAddress,
270
265
  };
271
266
 
272
267
  next();
package/src/validate.js CHANGED
@@ -52,6 +52,7 @@ export const schemaString = (min = 1, max = 255, optional = false) => ({
52
52
  });
53
53
  export const schemaPassword = (optional = false) => ({
54
54
  type: 'string',
55
+ convert: true,
55
56
  min: 6,
56
57
  max: 32,
57
58
  optional,
@@ -86,6 +87,7 @@ export const schemaPhoneNumber = (optional = false) => ({
86
87
  });
87
88
  export const schemaSlug = (optional = false) => ({
88
89
  type: 'string',
90
+ convert: true,
89
91
  pattern: /[A-Za-z0-9_-]+/,
90
92
  lowercase: true,
91
93
  max: 300,