joye-backend-utility 8.2.7 → 8.2.9

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,7 @@ class database {
29
29
  con.model('User_Message', schema_1.UserMessageSchema);
30
30
  con.model('User_Message_Log', schema_1.UserMessageLogSchema);
31
31
  con.model('User_Notification_Log', schema_1.UserNotificationLogSchema);
32
+ con.model('User_Consent_History', schema_1.UserConsentHistorySchema);
32
33
  con.model('Database_Info', schema_1.DatabaseInfoSchema);
33
34
  con.model('Master_Video', schema_1.MasterVideoSchema);
34
35
  con.model('Master_Blessings_Data', schema_1.MasterBlessingsDataSchema);
@@ -19,6 +19,7 @@ export { UserMeetingSchema } from './userMeeting';
19
19
  export { UserMessageSchema } from './userMessages';
20
20
  export { UserMessageLogSchema } from './userMessagesLog';
21
21
  export { UserNotificationLogSchema } from './userNotificationLog';
22
+ export { UserConsentHistorySchema } from './userConsentHistory';
22
23
  export { UserSchema } from './user';
23
24
  export { DatabaseInfoSchema } from './databaseInfo';
24
25
  export { MasterVideoSchema } from './masterVideo';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LlmBatchJobSchema = exports.UserAnalyticSchema = exports.AIResponsesTrackingSchema = exports.UserProfileSchema = exports.UserChatSessionSchema = exports.FeatureFeedbackSchema = exports.UserWeekActivitySchema = exports.UserTrainingRemindersSchema = exports.UserTrainingDailyDataSchema = exports.MasterTrainingDaysSchema = 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.UserNotificationLogSchema = exports.UserMessageLogSchema = exports.UserMessageSchema = exports.UserMeetingSchema = exports.UserLogSchema = exports.PlatformSchema = exports.OrganizationAnalyticsSchema = exports.OrganizationSchema = exports.MasterThemeMessageSchema = exports.MasterThemeDataSchema = exports.MasterPredictionEmotionsMessageMappingSchema = exports.MasterPredictionEmotionMessageSchema = exports.MasterPredictionEmotionSchema = exports.MasterPodcastSchema = exports.MasterEmotionMessageTypeThemeMappingSchema = exports.MasterEmotionsMessageMappingSchemaV2 = exports.MasterEmotionsMessageMappingSchema = exports.MasterEmotionsSchema = exports.MasterDataSchema = exports.MasterAppSettingSchema = exports.BrewSchema = void 0;
4
- exports.UserEmotionalHealthDetailSchema = exports.UserEmotionalHealthSchema = exports.UserWellbeingDataSchema = exports.UserSuperPowerDataSchema = exports.MasterSuperPowerRuleSchema = exports.MasterSuperPowerDataSchema = exports.MasterEmotionalHealthSchema = exports.MasterEmotionalDriverSchema = exports.MasterEmotionsSchemaV2 = exports.ErrorLogSchema = exports.PageViewSchema = exports.AIPromptsSchema = void 0;
3
+ exports.UserAnalyticSchema = exports.AIResponsesTrackingSchema = exports.UserProfileSchema = exports.UserChatSessionSchema = exports.FeatureFeedbackSchema = exports.UserWeekActivitySchema = exports.UserTrainingRemindersSchema = exports.UserTrainingDailyDataSchema = exports.MasterTrainingDaysSchema = 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.UserConsentHistorySchema = exports.UserNotificationLogSchema = exports.UserMessageLogSchema = exports.UserMessageSchema = exports.UserMeetingSchema = exports.UserLogSchema = exports.PlatformSchema = exports.OrganizationAnalyticsSchema = exports.OrganizationSchema = exports.MasterThemeMessageSchema = exports.MasterThemeDataSchema = exports.MasterPredictionEmotionsMessageMappingSchema = exports.MasterPredictionEmotionMessageSchema = exports.MasterPredictionEmotionSchema = exports.MasterPodcastSchema = exports.MasterEmotionMessageTypeThemeMappingSchema = exports.MasterEmotionsMessageMappingSchemaV2 = exports.MasterEmotionsMessageMappingSchema = exports.MasterEmotionsSchema = exports.MasterDataSchema = exports.MasterAppSettingSchema = exports.BrewSchema = void 0;
4
+ exports.UserEmotionalHealthDetailSchema = exports.UserEmotionalHealthSchema = exports.UserWellbeingDataSchema = exports.UserSuperPowerDataSchema = exports.MasterSuperPowerRuleSchema = exports.MasterSuperPowerDataSchema = exports.MasterEmotionalHealthSchema = exports.MasterEmotionalDriverSchema = exports.MasterEmotionsSchemaV2 = exports.ErrorLogSchema = exports.PageViewSchema = exports.AIPromptsSchema = exports.LlmBatchJobSchema = void 0;
5
5
  var brew_1 = require("./brew");
6
6
  Object.defineProperty(exports, "BrewSchema", { enumerable: true, get: function () { return brew_1.BrewSchema; } });
7
7
  var masterAppSetting_1 = require("./masterAppSetting");
@@ -44,6 +44,8 @@ var userMessagesLog_1 = require("./userMessagesLog");
44
44
  Object.defineProperty(exports, "UserMessageLogSchema", { enumerable: true, get: function () { return userMessagesLog_1.UserMessageLogSchema; } });
45
45
  var userNotificationLog_1 = require("./userNotificationLog");
46
46
  Object.defineProperty(exports, "UserNotificationLogSchema", { enumerable: true, get: function () { return userNotificationLog_1.UserNotificationLogSchema; } });
47
+ var userConsentHistory_1 = require("./userConsentHistory");
48
+ Object.defineProperty(exports, "UserConsentHistorySchema", { enumerable: true, get: function () { return userConsentHistory_1.UserConsentHistorySchema; } });
47
49
  var user_1 = require("./user");
48
50
  Object.defineProperty(exports, "UserSchema", { enumerable: true, get: function () { return user_1.UserSchema; } });
49
51
  var databaseInfo_1 = require("./databaseInfo");
@@ -80,6 +80,22 @@ const OrganizationUserAttrPermission = new mongoose_1.Schema({
80
80
  type: String,
81
81
  required: false,
82
82
  },
83
+ /**
84
+ * Max user messages in one chat. Used before platform maxTurnsPerChat, then the code default.
85
+ * Unset inherits. 0 means no user messages.
86
+ */
87
+ maxTurnsPerChat: {
88
+ type: Number,
89
+ required: false,
90
+ },
91
+ /**
92
+ * Max chat sessions per user per calendar day. Used before platform maxChatsPerDay, then the code default.
93
+ * Unset inherits. 0 means no new chats.
94
+ */
95
+ d: {
96
+ type: Number,
97
+ required: false,
98
+ },
83
99
  // Sample data
84
100
  /* aiModels: {
85
101
  "brew": "claude-sonnet-4-20250514",
@@ -48,6 +48,22 @@ const Platform = new mongoose_1.Schema({
48
48
  type: String,
49
49
  required: false,
50
50
  },
51
+ /**
52
+ * Max user messages in one chat. Used when the tenant has no maxTurnsPerChat.
53
+ * Unset inherits the code default. 0 means no user messages.
54
+ */
55
+ maxTurnsPerChat: {
56
+ type: Number,
57
+ required: false,
58
+ },
59
+ /**
60
+ * Max chat sessions per user per calendar day. Used when the tenant has no maxChatsPerDay.
61
+ * Unset inherits the code default. 0 means no new chats.
62
+ */
63
+ maxChatsPerDay: {
64
+ type: Number,
65
+ required: false,
66
+ },
51
67
  // Sample data
52
68
  /* aiModels: {
53
69
  "brew": "claude-sonnet-4-20250514",
@@ -0,0 +1,2 @@
1
+ import { Schema } from 'mongoose';
2
+ export declare const UserConsentHistorySchema: Schema<import("mongoose").Document<any, any, any>, import("mongoose").Model<import("mongoose").Document<any, any, any>, any, any>, undefined, {}>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserConsentHistorySchema = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ /**
6
+ * Audit log of consent accept, decline, and withdraw events.
7
+ * Current state stays on User.consent / User.consentVia / User.consentTime.
8
+ */
9
+ const UserConsentHistory = new mongoose_1.Schema({
10
+ employeeId: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ /** accept | withdraw | decline */
15
+ action: {
16
+ type: String,
17
+ required: true,
18
+ },
19
+ consent: {
20
+ type: Boolean,
21
+ required: true,
22
+ },
23
+ consentVia: {
24
+ type: String,
25
+ required: false,
26
+ },
27
+ previousConsent: {
28
+ type: Boolean,
29
+ required: false,
30
+ },
31
+ actionTime: {
32
+ type: Number,
33
+ required: true,
34
+ },
35
+ });
36
+ UserConsentHistory.index({ employeeId: 1, actionTime: -1 });
37
+ exports.UserConsentHistorySchema = UserConsentHistory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joye-backend-utility",
3
- "version": "8.2.7",
3
+ "version": "8.2.9",
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",