@common_ch/common 1.0.435 → 1.0.438

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.
@@ -0,0 +1,11 @@
1
+ import { Types } from "mongoose";
2
+ import { Subjects } from "../../subjects";
3
+ export interface CommentCreatedEvent {
4
+ subject: Subjects.CommentCreateEvent;
5
+ data: {
6
+ id: Types.ObjectId;
7
+ userId: Types.ObjectId;
8
+ title: string;
9
+ comment: string;
10
+ };
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { Types } from "mongoose";
2
+ import { Subjects } from "../../subjects";
3
+ export interface CommentApproveEvent {
4
+ subject: Subjects.CommentApproveEvent;
5
+ data: {
6
+ id: Types.ObjectId;
7
+ };
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { Types } from "mongoose";
2
+ import { Subjects } from "../../subjects";
3
+ export interface SettingUpdateEvent {
4
+ subject: Subjects.SettingUpdateEvent;
5
+ data: {
6
+ id: Types.ObjectId;
7
+ };
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -12,6 +12,7 @@ export declare enum Subjects {
12
12
  UserUpdateAllVersionRequest = "user:update-all-version-request",
13
13
  UserUpdateAllVersion = "user:update-all-version",
14
14
  UserUpdateWalletInApp = "user:update-wallet-in-app",
15
+ SettingUpdateEvent = "setting:update",
15
16
  AdminCreated = "admin:created",
16
17
  AdminUpdatedInPortal = "admin:updated-in-portal",
17
18
  AdminChangedStatusInPortal = "admin:changed-status-in-portal",
@@ -46,6 +47,8 @@ export declare enum Subjects {
46
47
  TicketAnsweredByUser = "ticket:answered-by-user",
47
48
  TicketDoneByUser = "ticket:done-by-user",
48
49
  FeedbackCreatedEvent = "feedback:created",
50
+ CommentCreateEvent = "comment:created",
51
+ CommentApproveEvent = "comment:approve",
49
52
  PlanCreated = "plan:created",
50
53
  PlanUpdated = "plan:updated",
51
54
  PlanChangeStatus = "plan:change-status",
@@ -16,6 +16,7 @@ var Subjects;
16
16
  Subjects["UserUpdateAllVersionRequest"] = "user:update-all-version-request";
17
17
  Subjects["UserUpdateAllVersion"] = "user:update-all-version";
18
18
  Subjects["UserUpdateWalletInApp"] = "user:update-wallet-in-app";
19
+ Subjects["SettingUpdateEvent"] = "setting:update";
19
20
  Subjects["AdminCreated"] = "admin:created";
20
21
  Subjects["AdminUpdatedInPortal"] = "admin:updated-in-portal";
21
22
  Subjects["AdminChangedStatusInPortal"] = "admin:changed-status-in-portal";
@@ -50,6 +51,8 @@ var Subjects;
50
51
  Subjects["TicketAnsweredByUser"] = "ticket:answered-by-user";
51
52
  Subjects["TicketDoneByUser"] = "ticket:done-by-user";
52
53
  Subjects["FeedbackCreatedEvent"] = "feedback:created";
54
+ Subjects["CommentCreateEvent"] = "comment:created";
55
+ Subjects["CommentApproveEvent"] = "comment:approve";
53
56
  Subjects["PlanCreated"] = "plan:created";
54
57
  Subjects["PlanUpdated"] = "plan:updated";
55
58
  Subjects["PlanChangeStatus"] = "plan:change-status";
package/build/index.d.ts CHANGED
@@ -33,6 +33,9 @@ export * from './events/portal/ai-option/ai-option-changeStatus-event';
33
33
  export * from './events/portal/ai-option/ai-option-updated-event';
34
34
  export * from './events/portal/ai-option/ai-option-set-default-show-event';
35
35
  export * from './events/portal/ai-option/ai-option-unset-defaultShow-event';
36
+ export * from './events/portal/comment/comment-approve-event';
37
+ export * from './events/app/comment/comment-create-event';
38
+ export * from './events/portal/setting/setting-approve-event';
36
39
  export * from './events/portal/user/user-updated-event';
37
40
  export * from './events/portal/user/user-change-status-event';
38
41
  export * from './events/portal/user/user-updated-wallet-event';
package/build/index.js CHANGED
@@ -59,6 +59,9 @@ __exportStar(require("./events/portal/ai-option/ai-option-changeStatus-event"),
59
59
  __exportStar(require("./events/portal/ai-option/ai-option-updated-event"), exports);
60
60
  __exportStar(require("./events/portal/ai-option/ai-option-set-default-show-event"), exports);
61
61
  __exportStar(require("./events/portal/ai-option/ai-option-unset-defaultShow-event"), exports);
62
+ __exportStar(require("./events/portal/comment/comment-approve-event"), exports);
63
+ __exportStar(require("./events/app/comment/comment-create-event"), exports);
64
+ __exportStar(require("./events/portal/setting/setting-approve-event"), exports);
62
65
  __exportStar(require("./events/portal/user/user-updated-event"), exports);
63
66
  __exportStar(require("./events/portal/user/user-change-status-event"), exports);
64
67
  __exportStar(require("./events/portal/user/user-updated-wallet-event"), exports);
@@ -0,0 +1,24 @@
1
+ import mongoose, { Types } from 'mongoose';
2
+ export interface CommentAttrs {
3
+ userId: Types.ObjectId;
4
+ title: string;
5
+ comment: string;
6
+ approve: boolean;
7
+ createdAt?: number;
8
+ updatedAt?: number;
9
+ }
10
+ interface CommentModel extends mongoose.Model<CommentDoc> {
11
+ build(attrs: CommentAttrs): CommentDoc;
12
+ }
13
+ export interface CommentDoc extends mongoose.Document {
14
+ _id: Types.ObjectId;
15
+ userId: Types.ObjectId;
16
+ title: string;
17
+ comment: string;
18
+ approve: boolean;
19
+ createdAt?: number;
20
+ updatedAt?: number;
21
+ version: number;
22
+ }
23
+ declare const Comment: CommentModel;
24
+ export { Comment };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Comment = void 0;
7
+ const mongoose_1 = __importDefault(require("mongoose"));
8
+ const mongoose_update_if_current_1 = require("mongoose-update-if-current");
9
+ const commentSchema = new mongoose_1.default.Schema({
10
+ userId: {
11
+ type: mongoose_1.default.Schema.Types.ObjectId,
12
+ ref: 'User',
13
+ required: true,
14
+ },
15
+ title: {
16
+ type: String,
17
+ required: true,
18
+ },
19
+ comment: {
20
+ type: String,
21
+ required: true,
22
+ },
23
+ approve: {
24
+ type: Boolean,
25
+ required: true,
26
+ default: false,
27
+ },
28
+ createdAt: {
29
+ type: mongoose_1.default.Schema.Types.Date,
30
+ },
31
+ updatedAt: {
32
+ type: mongoose_1.default.Schema.Types.Date,
33
+ },
34
+ }, {
35
+ timestamps: true,
36
+ });
37
+ commentSchema.set('versionKey', 'version');
38
+ commentSchema.plugin(mongoose_update_if_current_1.updateIfCurrentPlugin);
39
+ commentSchema.index({ userId: 1 });
40
+ commentSchema.index({ approve: 1 });
41
+ commentSchema.statics.build = (attrs) => {
42
+ return new Comment(attrs);
43
+ };
44
+ const Comment = mongoose_1.default.model('Comment', commentSchema);
45
+ exports.Comment = Comment;
@@ -4,6 +4,7 @@ export interface FeedbackAttrs {
4
4
  userId: Types.ObjectId;
5
5
  aiId?: Types.ObjectId;
6
6
  comment?: string;
7
+ rating?: number;
7
8
  type: FeedbackTypeEnum;
8
9
  createdAt?: number;
9
10
  updatedAt?: number;
@@ -120,6 +120,7 @@ const planSchema = new mongoose_1.default.Schema({
120
120
  planSchema.set('versionKey', 'version');
121
121
  planSchema.plugin(mongoose_update_if_current_1.updateIfCurrentPlugin);
122
122
  planSchema.index({ 'status': 1 });
123
+ planSchema.index({ 'order': 1 });
123
124
  planSchema.statics.build = (attrs) => {
124
125
  return new Plan(attrs);
125
126
  };
@@ -0,0 +1,18 @@
1
+ import mongoose, { Types } from 'mongoose';
2
+ export interface SettingAttrs {
3
+ numberOfComment: number;
4
+ createdAt?: number;
5
+ updatedAt?: number;
6
+ }
7
+ interface SettingModel extends mongoose.Model<SettingDoc> {
8
+ build(attrs: SettingAttrs): SettingDoc;
9
+ }
10
+ export interface SettingDoc extends mongoose.Document {
11
+ _id: Types.ObjectId;
12
+ numberOfComment: number;
13
+ createdAt?: number;
14
+ updatedAt?: number;
15
+ version: number;
16
+ }
17
+ declare const Setting: SettingModel;
18
+ export { Setting };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Setting = void 0;
7
+ const mongoose_1 = __importDefault(require("mongoose"));
8
+ const mongoose_update_if_current_1 = require("mongoose-update-if-current");
9
+ const settingSchema = new mongoose_1.default.Schema({
10
+ numberOfComment: {
11
+ type: Number,
12
+ required: true,
13
+ },
14
+ createdAt: {
15
+ type: mongoose_1.default.Schema.Types.Date,
16
+ },
17
+ updatedAt: {
18
+ type: mongoose_1.default.Schema.Types.Date,
19
+ },
20
+ }, {
21
+ timestamps: true,
22
+ });
23
+ settingSchema.set('versionKey', 'version');
24
+ settingSchema.plugin(mongoose_update_if_current_1.updateIfCurrentPlugin);
25
+ settingSchema.statics.build = (attrs) => {
26
+ return new Setting(attrs);
27
+ };
28
+ const Setting = mongoose_1.default.model('Setting', settingSchema);
29
+ exports.Setting = Setting;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common_ch/common",
3
- "version": "1.0.435",
3
+ "version": "1.0.438",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [