@vasrefil/api-toolkit 1.0.51 → 1.0.52

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/dist/env.d.ts CHANGED
@@ -5,7 +5,7 @@ declare enum NODE_ENVS {
5
5
  }
6
6
  declare const env: {
7
7
  NODE_ENV: NODE_ENVS;
8
- MONGODB_URI: string;
8
+ MONGODB_URI: string | undefined;
9
9
  API_KEY: string | undefined;
10
10
  SERVICE_NAME: string | undefined;
11
11
  REDIS_URL: string;
package/dist/env.js CHANGED
@@ -11,7 +11,7 @@ var NODE_ENVS;
11
11
  let NODE_ENV = process.env.NODE_ENV;
12
12
  const env = {
13
13
  NODE_ENV,
14
- MONGODB_URI: '',
14
+ MONGODB_URI: process.env.MONGODB_URI,
15
15
  API_KEY: process.env.API_KEY,
16
16
  SERVICE_NAME: process.env.SERVICE_NAME,
17
17
  REDIS_URL: process.env.REDIS_URL,
@@ -25,6 +25,14 @@ class QueryHelper_ {
25
25
  else if (fit.operator === 'is_not') {
26
26
  result.push({ [fit.field]: { $ne: fit.value } });
27
27
  }
28
+ else if (fit.operator === 'gte') {
29
+ const value = isNaN(fit.value) ? fit.value : Number(fit.value);
30
+ result.push({ [fit.field]: { $gte: value } });
31
+ }
32
+ else if (fit.operator === 'lte') {
33
+ const value = isNaN(fit.value) ? fit.value : Number(fit.value);
34
+ result.push({ [fit.field]: { $lte: value } });
35
+ }
28
36
  });
29
37
  filter_query = { [logical_operator]: result };
30
38
  }
@@ -2,6 +2,7 @@ import { Document, Model } from "mongoose";
2
2
  export interface ISample extends Document {
3
3
  name: string;
4
4
  description?: string;
5
+ number?: number;
5
6
  }
6
7
  export interface ISampleModel extends Model<ISample> {
7
8
  }
@@ -8,6 +8,9 @@ const schema = new mongoose_1.Schema({
8
8
  description: {
9
9
  type: String
10
10
  },
11
+ number: {
12
+ type: Number
13
+ },
11
14
  }, { timestamps: true });
12
15
  schema.index({});
13
16
  const SampleModel = (0, mongoose_1.model)('sample', schema);
@@ -38,7 +38,8 @@ class SampleValidator {
38
38
  constructor() {
39
39
  this.create = joi.object({
40
40
  name: joi.string().required(),
41
- description: joi.string().required()
41
+ description: joi.string().required(),
42
+ number: joi.number().required(),
42
43
  });
43
44
  }
44
45
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vasrefil/api-toolkit",
3
3
  "description": "This is Vasrefil API toolkit",
4
- "version": "1.0.51",
4
+ "version": "1.0.52",
5
5
  "author": "Sodiq Alabi",
6
6
  "main": "dist/public-api.js",
7
7
  "types": "dist/public-api.d.ts",