joye-backend-utility 2.0.4 → 2.0.7

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/database.js CHANGED
@@ -14,6 +14,7 @@ class database {
14
14
  useFindAndModify: false,
15
15
  user: config_1.DB_USER || '',
16
16
  pass: config_1.DB_PASSWORD || '',
17
+ // autoIndex: false, // True only for development
17
18
  },
18
19
  };
19
20
  if (env !== 'production') {
@@ -102,4 +102,12 @@ const BrewSchema = new mongoose_1.Schema({
102
102
  required: true,
103
103
  },
104
104
  });
105
- exports.BrewModel = (0, mongoose_1.model)('Brew', BrewSchema);
105
+ /* BrewSchema.index(
106
+ { userId: 1, date: -1 },
107
+ {
108
+ unique: true,
109
+ },
110
+ ); */
111
+ const brewModel = (0, mongoose_1.model)('Brew', BrewSchema);
112
+ brewModel.syncIndexes();
113
+ exports.BrewModel = brewModel;
@@ -0,0 +1,2 @@
1
+ /// <reference types="mongoose" />
2
+ export declare const CounterModel: import("mongoose").Model<import("mongoose").Document<any, any, any>, any, any>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CounterModel = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const CounterSchema = new mongoose_1.Schema({
6
+ counterId: {
7
+ type: mongoose_1.Types.ObjectId,
8
+ required: true,
9
+ },
10
+ counterKey: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ counterValue: {
15
+ type: Number,
16
+ required: true,
17
+ },
18
+ });
19
+ exports.CounterModel = (0, mongoose_1.model)('Counter', CounterSchema);
@@ -6,6 +6,7 @@ const MasterAppSettingSchema = new mongoose_1.Schema({
6
6
  key: {
7
7
  type: String,
8
8
  required: true,
9
+ // index: true,
9
10
  },
10
11
  name: {
11
12
  type: String,
@@ -6,6 +6,7 @@ const MasterDataSchema = new mongoose_1.Schema({
6
6
  key: {
7
7
  type: String,
8
8
  required: true,
9
+ // index: true,
9
10
  },
10
11
  dataType: {
11
12
  type: String,
@@ -6,6 +6,7 @@ const MasterEmotionsSchema = new mongoose_1.Schema({
6
6
  key: {
7
7
  type: String,
8
8
  required: true,
9
+ // index: true,
9
10
  },
10
11
  name: {
11
12
  type: String,
@@ -6,6 +6,7 @@ const MasterPodcastSchema = new mongoose_1.Schema({
6
6
  key: {
7
7
  type: String,
8
8
  required: true,
9
+ // index: true,
9
10
  },
10
11
  file: {
11
12
  type: String,
@@ -6,6 +6,7 @@ const MasterPredictionEmotionMessageSchema = new mongoose_1.Schema({
6
6
  masterPredictionEmotionKey: {
7
7
  type: String,
8
8
  required: true,
9
+ // index: true,
9
10
  },
10
11
  messages: {
11
12
  type: Array,
@@ -6,6 +6,7 @@ const MasterThemeDataSchema = new mongoose_1.Schema({
6
6
  theme: {
7
7
  type: Number,
8
8
  required: true,
9
+ // index: true,
9
10
  },
10
11
  appreciationMessages: {
11
12
  type: Array,
@@ -18,6 +18,7 @@ const OrganizationSchema = new mongoose_1.Schema({
18
18
  tId: {
19
19
  type: String,
20
20
  required: true,
21
+ // index: true,
21
22
  },
22
23
  emergency: {
23
24
  type: Object,
@@ -40,4 +41,6 @@ const OrganizationSchema = new mongoose_1.Schema({
40
41
  required: false,
41
42
  },
42
43
  });
43
- exports.OrganizationModel = (0, mongoose_1.model)('Organization', OrganizationSchema);
44
+ const organizationModel = (0, mongoose_1.model)('Organization', OrganizationSchema);
45
+ // organizationModel.syncIndexes();
46
+ exports.OrganizationModel = organizationModel;
@@ -10,6 +10,7 @@ const UserSchema = new mongoose_1.Schema({
10
10
  employeeId: {
11
11
  type: String,
12
12
  required: true,
13
+ // index: true,
13
14
  },
14
15
  happinessCounterLifetime: {
15
16
  type: Object,
@@ -103,6 +104,13 @@ const UserSchema = new mongoose_1.Schema({
103
104
  },
104
105
  botDetails: {
105
106
  type: Object,
107
+ // index: true,
108
+ },
109
+ uniqueCode: {
110
+ type: String,
111
+ required: false,
106
112
  },
107
113
  });
108
- exports.UserModel = (0, mongoose_1.model)('User', UserSchema);
114
+ const userModel = (0, mongoose_1.model)('User', UserSchema);
115
+ // userModel.syncIndexes();
116
+ exports.UserModel = userModel;
@@ -37,4 +37,7 @@ const UserMessageLogSchema = new mongoose_1.Schema({
37
37
  required: false,
38
38
  },
39
39
  });
40
- exports.UserMessageLogModel = (0, mongoose_1.model)('User_Message_Log', UserMessageLogSchema);
40
+ // UserMessageLogSchema.index({ employeeId: 1, activityId: -1 });
41
+ const userMessageLogModel = (0, mongoose_1.model)('User_Message_Log', UserMessageLogSchema);
42
+ // userMessageLogModel.syncIndexes();
43
+ exports.UserMessageLogModel = userMessageLogModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joye-backend-utility",
3
- "version": "2.0.4",
3
+ "version": "2.0.7",
4
4
  "description": "Joye backend utility for db functions and common functions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,8 +16,7 @@
16
16
  "postinstall": "npm run build",
17
17
  "lint": "eslint --ignore-path .gitignore --ext .ts .",
18
18
  "lint:fix": "npm run lint -- --fix",
19
- "prepare": "husky install && yarn build",
20
- "publish": "npm publish"
19
+ "prepare": "husky install && yarn build"
21
20
  },
22
21
  "repository": {
23
22
  "type": "git",