joye-backend-utility 4.1.20 → 4.1.22-test

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
@@ -29,6 +29,8 @@ class database {
29
29
  con.model('Database_Info', schema_1.DatabaseInfoSchema);
30
30
  con.model('Master_Video', schema_1.MasterVideoSchema);
31
31
  con.model('Master_Blessings_Data', schema_1.MasterBlessingsDataSchema);
32
+ con.model('Master_Suggestions_Message', schema_1.MasterSuggestionsMessageSchema);
33
+ con.model('Master_Suggestions_Parameter', schema_1.MasterSuggestionsParameterSchema);
32
34
  };
33
35
  this.connectToDatabase = () => {
34
36
  const env = config_1.NODE_ENV || 'development';
package/dist/jwt.js CHANGED
@@ -2,17 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.jwtVerify = exports.createToken = void 0;
4
4
  const jwt = require('jsonwebtoken');
5
- const JWT_SECRET = '3s6v9y$B&E)H+MbQeThWmZq4t7w!z%C*F-JaNcRfUjXn2r5u8x/A?D(G+KbPeSgV';
5
+ const fs_1 = require("fs");
6
+ // const JWT_SECRET = '3s6v9y$B&E)H+MbQeThWmZq4t7w!z%C*F-JaNcRfUjXn2r5u8x/A?D(G+KbPeSgV';
7
+ const JWT_SECRET = '64d5f73bb3f132821122d68330263edd44023810a1f05efb701fc7ec8d0f6382';
8
+ const JWT_PRIVATE_KEY = fs_1.default.readFileSync(`jwt-keys/jwtRS256.key`, 'utf8');
9
+ const JWT_PUBLIC_KEY = fs_1.default.readFileSync(`jwt-keys/jwtRS256.key.pub`, 'utf8');
6
10
  const createToken = async (payload, expiresIn) => {
7
- const token = jwt.sign(payload, process.env.JWT_SECRET || JWT_SECRET, {
11
+ const token = jwt.sign(payload, { key: JWT_PRIVATE_KEY.replace(/\\n/gm, '\n'), passphrase: JWT_SECRET }, {
8
12
  expiresIn,
9
- algorithm: 'HS256',
13
+ algorithm: 'RS256',
10
14
  });
11
15
  return token;
12
16
  };
13
17
  exports.createToken = createToken;
14
18
  const jwtVerify = async (token) => new Promise(resolve => {
15
- jwt.verify(token, process.env.JWT_SECRET || JWT_SECRET, async (err, decoded) => {
19
+ jwt.verify(token, JWT_PUBLIC_KEY.replace(/\\n/gm, '\n'), async (err, decoded) => {
16
20
  if (err) {
17
21
  return resolve(err);
18
22
  }
@@ -20,3 +20,5 @@ export { UserSchema } from './user';
20
20
  export { DatabaseInfoSchema } from './databaseInfo';
21
21
  export { MasterVideoSchema } from './masterVideo';
22
22
  export { MasterBlessingsDataSchema } from './masterBlessingsData';
23
+ export { MasterSuggestionsMessageSchema } from './masterSuggestionsMessage.model';
24
+ export { MasterSuggestionsParameterSchema } from './masterSuggestionsParameter.model';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MasterBlessingsDataSchema = exports.MasterVideoSchema = exports.DatabaseInfoSchema = exports.UserSchema = exports.UserMessageLogSchema = exports.UserMessageSchema = exports.UserMeetingSchema = exports.UserLogSchema = exports.PlatformSchema = exports.OrganizationSchema = exports.MasterThemeMessageSchema = exports.MasterThemeDataSchema = exports.MasterPredictionEmotionsMessageMappingSchema = exports.MasterPredictionEmotionMessageSchema = exports.MasterPredictionEmotionSchema = exports.MasterPodcastSchema = exports.MasterEmotionMessageTypeThemeMappingSchema = exports.MasterEmotionsMessageMappingSchema = exports.MasterEmotionsSchema = exports.MasterDataSchema = exports.MasterAppSettingSchema = exports.BrewSchema = void 0;
3
+ exports.MasterSuggestionsParameterSchema = exports.MasterSuggestionsMessageSchema = exports.MasterBlessingsDataSchema = exports.MasterVideoSchema = exports.DatabaseInfoSchema = exports.UserSchema = exports.UserMessageLogSchema = exports.UserMessageSchema = exports.UserMeetingSchema = exports.UserLogSchema = exports.PlatformSchema = exports.OrganizationSchema = exports.MasterThemeMessageSchema = exports.MasterThemeDataSchema = exports.MasterPredictionEmotionsMessageMappingSchema = exports.MasterPredictionEmotionMessageSchema = exports.MasterPredictionEmotionSchema = exports.MasterPodcastSchema = exports.MasterEmotionMessageTypeThemeMappingSchema = exports.MasterEmotionsMessageMappingSchema = exports.MasterEmotionsSchema = exports.MasterDataSchema = exports.MasterAppSettingSchema = exports.BrewSchema = void 0;
4
4
  var brew_1 = require("./brew");
5
5
  Object.defineProperty(exports, "BrewSchema", { enumerable: true, get: function () { return brew_1.BrewSchema; } });
6
6
  var masterAppSetting_1 = require("./masterAppSetting");
@@ -45,3 +45,7 @@ var masterVideo_1 = require("./masterVideo");
45
45
  Object.defineProperty(exports, "MasterVideoSchema", { enumerable: true, get: function () { return masterVideo_1.MasterVideoSchema; } });
46
46
  var masterBlessingsData_1 = require("./masterBlessingsData");
47
47
  Object.defineProperty(exports, "MasterBlessingsDataSchema", { enumerable: true, get: function () { return masterBlessingsData_1.MasterBlessingsDataSchema; } });
48
+ var masterSuggestionsMessage_model_1 = require("./masterSuggestionsMessage.model");
49
+ Object.defineProperty(exports, "MasterSuggestionsMessageSchema", { enumerable: true, get: function () { return masterSuggestionsMessage_model_1.MasterSuggestionsMessageSchema; } });
50
+ var masterSuggestionsParameter_model_1 = require("./masterSuggestionsParameter.model");
51
+ Object.defineProperty(exports, "MasterSuggestionsParameterSchema", { enumerable: true, get: function () { return masterSuggestionsParameter_model_1.MasterSuggestionsParameterSchema; } });
@@ -0,0 +1,2 @@
1
+ import { Schema } from 'mongoose';
2
+ export declare const MasterSuggestionsMessageSchema: Schema<import("mongoose").Document<any, any, any>, import("mongoose").Model<import("mongoose").Document<any, any, any>, any, any>, undefined, {}>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MasterSuggestionsMessageSchema = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const MasterSuggestionsMessage = new mongoose_1.Schema({
6
+ category: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ emotion: {
11
+ type: String,
12
+ required: false,
13
+ },
14
+ messageType: {
15
+ type: String,
16
+ required: false,
17
+ },
18
+ messages: {
19
+ type: Array,
20
+ required: false,
21
+ },
22
+ });
23
+ exports.MasterSuggestionsMessageSchema = MasterSuggestionsMessage;
@@ -0,0 +1,2 @@
1
+ import { Schema } from 'mongoose';
2
+ export declare const MasterSuggestionsParameterSchema: Schema<import("mongoose").Document<any, any, any>, import("mongoose").Model<import("mongoose").Document<any, any, any>, any, any>, undefined, {}>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MasterSuggestionsParameterSchema = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const MasterSuggestionsParameter = new mongoose_1.Schema({
6
+ category: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ minValue: {
11
+ type: Number,
12
+ required: false,
13
+ },
14
+ maxValue: {
15
+ type: Number,
16
+ required: false,
17
+ },
18
+ type: {
19
+ type: String,
20
+ required: false,
21
+ },
22
+ });
23
+ exports.MasterSuggestionsParameterSchema = MasterSuggestionsParameter;
@@ -138,5 +138,9 @@ const User = new mongoose_1.Schema({
138
138
  type: Number,
139
139
  required: false,
140
140
  },
141
+ lastRecommendationCategory: {
142
+ type: String,
143
+ required: false,
144
+ },
141
145
  });
142
146
  exports.UserSchema = User;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joye-backend-utility",
3
- "version": "4.1.20",
3
+ "version": "4.1.22-test",
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",
@@ -31,6 +31,7 @@
31
31
  "dependencies": {
32
32
  "bcrypt": "^5.0.1",
33
33
  "dotenv": "^16.0.0",
34
+ "fs": "^0.0.1-security",
34
35
  "jsonwebtoken": "^9.0.0",
35
36
  "moment": "^2.29.3",
36
37
  "mongoose": "^5.10.1",