joye-backend-utility 5.1.37 → 5.1.39

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
@@ -49,6 +49,8 @@ class database {
49
49
  con.model('User_Chat_session', schema_1.UserChatSessionSchema);
50
50
  con.model('User_Profile', schema_1.UserProfileSchema);
51
51
  con.model('AI_Responses_Tracking', schema_1.AIResponsesTrackingSchema);
52
+ con.model('User_Analytic', schema_1.UserAnalyticSchema);
53
+ con.model('AI_Prompts', schema_1.AIPromptsSchema);
52
54
  };
53
55
  this.connectToDatabase = () => {
54
56
  const env = config_1.NODE_ENV || 'development';
@@ -0,0 +1,2 @@
1
+ import { Schema } from 'mongoose';
2
+ export declare const AIPromptsSchema: Schema<import("mongoose").Document<any, any, any>, import("mongoose").Model<import("mongoose").Document<any, any, any>, any, any>, undefined, {}>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AIPromptsSchema = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const AIPrompts = new mongoose_1.Schema({
6
+ type: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ model: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ prompt: {
15
+ type: String,
16
+ required: true,
17
+ },
18
+ history: {
19
+ type: Object,
20
+ required: false,
21
+ },
22
+ updatedAt: {
23
+ type: Number,
24
+ required: false,
25
+ },
26
+ updatedBy: {
27
+ type: String,
28
+ required: false,
29
+ },
30
+ });
31
+ AIPrompts.index({ type: 1, model: -1 }, {
32
+ unique: false,
33
+ });
34
+ exports.AIPromptsSchema = AIPrompts;
@@ -40,3 +40,5 @@ export { FeatureFeedbackSchema } from './featureFeedback';
40
40
  export { UserChatSessionSchema } from './userChatSession';
41
41
  export { UserProfileSchema } from './userProfile';
42
42
  export { AIResponsesTrackingSchema } from './ai_responses_tracking';
43
+ export { UserAnalyticSchema } from './user_analytic';
44
+ export { AIPromptsSchema } from './ai_prompts';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AIResponsesTrackingSchema = exports.UserProfileSchema = exports.UserChatSessionSchema = exports.FeatureFeedbackSchema = exports.UserWeekActivitySchema = exports.UserTrainingWeekDataSchema = exports.UserTrainingDataSchema = exports.MasterTrainingWeekSchema = exports.MasterTrainingSchema = exports.userJoyLevelQaSchema = exports.userGoalSchema = exports.OrganizationUserAttrPermissionSchema = exports.TimezoneSchema = exports.UserVideoSchema = exports.UserFeedbackSchema = exports.UserReminderSchema = exports.MasterLinkCardSchema = exports.UserRecommendationSchema = 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;
3
+ exports.AIPromptsSchema = exports.UserAnalyticSchema = exports.AIResponsesTrackingSchema = exports.UserProfileSchema = exports.UserChatSessionSchema = exports.FeatureFeedbackSchema = exports.UserWeekActivitySchema = exports.UserTrainingWeekDataSchema = exports.UserTrainingDataSchema = exports.MasterTrainingWeekSchema = exports.MasterTrainingSchema = exports.userJoyLevelQaSchema = exports.userGoalSchema = exports.OrganizationUserAttrPermissionSchema = exports.TimezoneSchema = exports.UserVideoSchema = exports.UserFeedbackSchema = exports.UserReminderSchema = exports.MasterLinkCardSchema = exports.UserRecommendationSchema = 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");
@@ -85,3 +85,7 @@ var userProfile_1 = require("./userProfile");
85
85
  Object.defineProperty(exports, "UserProfileSchema", { enumerable: true, get: function () { return userProfile_1.UserProfileSchema; } });
86
86
  var ai_responses_tracking_1 = require("./ai_responses_tracking");
87
87
  Object.defineProperty(exports, "AIResponsesTrackingSchema", { enumerable: true, get: function () { return ai_responses_tracking_1.AIResponsesTrackingSchema; } });
88
+ var user_analytic_1 = require("./user_analytic");
89
+ Object.defineProperty(exports, "UserAnalyticSchema", { enumerable: true, get: function () { return user_analytic_1.UserAnalyticSchema; } });
90
+ var ai_prompts_1 = require("./ai_prompts");
91
+ Object.defineProperty(exports, "AIPromptsSchema", { enumerable: true, get: function () { return ai_prompts_1.AIPromptsSchema; } });
@@ -73,12 +73,11 @@ const OrganizationUserAttrPermission = new mongoose_1.Schema({
73
73
  required: false,
74
74
  },
75
75
  // Sample data
76
- /* aiModels: Object
77
- {
78
- brew: "claude-sonnet-4-20250514",
79
- mindfulMin: "claude-3-5-haiku-20241022",
80
- byb: "claude-3-5-haiku-20241022",
81
- quickJL: "claude-sonnet-4-20250514",
76
+ /* aiModels: {
77
+ "brew": "claude-sonnet-4-20250514",
78
+ "byb": "claude-3-5-haiku-20241022",
79
+ "mindful-minute": "claude-sonnet-4-20250514",
80
+ "quick-jl": "claude-3-5-haiku-20241022"
82
81
  } */
83
82
  });
84
83
  exports.OrganizationUserAttrPermissionSchema = OrganizationUserAttrPermission;
@@ -29,12 +29,11 @@ const Platform = new mongoose_1.Schema({
29
29
  required: false,
30
30
  },
31
31
  // Sample data
32
- /* aiModels: Object
33
- {
34
- brew: "claude-sonnet-4-20250514",
35
- mindfulMin: "claude-3-5-haiku-20241022",
36
- byb: "claude-3-5-haiku-20241022",
37
- quickJL: "claude-sonnet-4-20250514",
32
+ /* aiModels: {
33
+ "brew": "claude-sonnet-4-20250514",
34
+ "byb": "claude-3-5-haiku-20241022",
35
+ "mindful-minute": "claude-sonnet-4-20250514",
36
+ "quick-jl": "claude-3-5-haiku-20241022"
38
37
  } */
39
38
  });
40
39
  exports.PlatformSchema = Platform;
@@ -0,0 +1,2 @@
1
+ import { Schema } from 'mongoose';
2
+ export declare const UserAnalyticSchema: Schema<import("mongoose").Document<any, any, any>, import("mongoose").Model<import("mongoose").Document<any, any, any>, any, any>, undefined, {}>;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserAnalyticSchema = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const UserAnalytic = new mongoose_1.Schema({
6
+ employeeId: {
7
+ type: String,
8
+ required: true,
9
+ index: true,
10
+ },
11
+ date: {
12
+ type: String,
13
+ required: true,
14
+ index: true,
15
+ },
16
+ weekNumber: {
17
+ type: Number,
18
+ },
19
+ year: {
20
+ type: Number,
21
+ required: true,
22
+ },
23
+ month: {
24
+ type: Number,
25
+ },
26
+ createdAt: {
27
+ type: Number,
28
+ required: true,
29
+ },
30
+ data: {
31
+ dominant_moods: {
32
+ type: [String],
33
+ default: [],
34
+ },
35
+ joy_level: {
36
+ current: { type: Number, default: 0 },
37
+ previous: { type: Number, default: 0 },
38
+ },
39
+ relationships: {
40
+ current: { type: Number, default: 0 },
41
+ previous: { type: Number, default: 0 },
42
+ },
43
+ optimism: {
44
+ current: { type: Number, default: 0 },
45
+ previous: { type: Number, default: 0 },
46
+ },
47
+ motivation: {
48
+ current: { type: Number, default: 0 },
49
+ previous: { type: Number, default: 0 },
50
+ },
51
+ irritability: {
52
+ current: { type: Number, default: 0 },
53
+ previous: { type: Number, default: 0 },
54
+ },
55
+ anxiety: {
56
+ current: { type: Number, default: 0 },
57
+ previous: { type: Number, default: 0 },
58
+ },
59
+ satisfaction: {
60
+ current: { type: Number, default: 0 },
61
+ previous: { type: Number, default: 0 },
62
+ },
63
+ happy_moments: {
64
+ current: { type: Number, default: 0 },
65
+ previous: { type: Number, default: 0 },
66
+ lifetime: { type: Number, default: 0 },
67
+ },
68
+ badges: {
69
+ current: { type: Number, default: 0 },
70
+ previous: { type: Number, default: 0 },
71
+ lifetime: { type: Number, default: 0 },
72
+ },
73
+ appreciations_sent: {
74
+ current: { type: Number, default: 0 },
75
+ previous: { type: Number, default: 0 },
76
+ lifetime: { type: Number, default: 0 },
77
+ },
78
+ appreciations_received: {
79
+ current: { type: Number, default: 0 },
80
+ previous: { type: Number, default: 0 },
81
+ lifetime: { type: Number, default: 0 },
82
+ },
83
+ resilience: {
84
+ now: { type: Number, default: 0 },
85
+ before: { type: Number, default: 0 },
86
+ },
87
+ },
88
+ });
89
+ UserAnalytic.index({ employeeId: 1, weekNumber: -1, year: -1, date: -1 });
90
+ UserAnalytic.index({ employeeId: 1, month: -1, year: -1, date: -1 });
91
+ exports.UserAnalyticSchema = UserAnalytic;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joye-backend-utility",
3
- "version": "5.1.37",
3
+ "version": "5.1.39",
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",