@common_ch/common 1.0.171 → 1.0.173

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,26 @@
1
+ import mongoose from 'mongoose';
2
+ import { AiOptionFieldEnum, AiOptionStatusEnum } from '../../events/portal/ai-option/ai-created-event';
3
+ export interface AiOptionAttrs {
4
+ _id: string;
5
+ name: string;
6
+ status?: AiOptionStatusEnum;
7
+ field: AiOptionFieldEnum;
8
+ aiId: string;
9
+ createdAt?: number;
10
+ updatedAt?: number;
11
+ }
12
+ interface AiOptionModel extends mongoose.Model<AiOptionDoc> {
13
+ build(attrs: AiOptionAttrs): AiOptionDoc;
14
+ }
15
+ export interface AiOptionDoc extends mongoose.Document {
16
+ _id: string;
17
+ name: string;
18
+ field: AiOptionFieldEnum;
19
+ aiId: string;
20
+ status: AiOptionStatusEnum;
21
+ version: number;
22
+ createdAt?: number;
23
+ updatedAt?: number;
24
+ }
25
+ declare const AiOption: AiOptionModel;
26
+ export { AiOption };
@@ -0,0 +1,48 @@
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.AiOption = void 0;
7
+ const mongoose_1 = __importDefault(require("mongoose"));
8
+ const mongoose_update_if_current_1 = require("mongoose-update-if-current");
9
+ const ai_created_event_1 = require("../../events/portal/ai-option/ai-created-event");
10
+ const aiOptionSchema = new mongoose_1.default.Schema({
11
+ name: {
12
+ type: String,
13
+ required: true,
14
+ },
15
+ status: {
16
+ type: String,
17
+ enum: ai_created_event_1.AiOptionStatusEnum,
18
+ default: ai_created_event_1.AiOptionStatusEnum.active,
19
+ },
20
+ field: {
21
+ type: String,
22
+ enum: ai_created_event_1.AiOptionFieldEnum,
23
+ default: ai_created_event_1.AiOptionFieldEnum.chat,
24
+ },
25
+ aiId: {
26
+ type: mongoose_1.default.Schema.Types.ObjectId,
27
+ ref: 'Ai',
28
+ require: true,
29
+ },
30
+ createdAt: {
31
+ type: mongoose_1.default.Schema.Types.Date,
32
+ },
33
+ updatedAt: {
34
+ type: mongoose_1.default.Schema.Types.Date,
35
+ },
36
+ }, {
37
+ timestamps: true,
38
+ });
39
+ aiOptionSchema.set('versionKey', 'version');
40
+ aiOptionSchema.plugin(mongoose_update_if_current_1.updateIfCurrentPlugin);
41
+ aiOptionSchema.index({ name: 1 });
42
+ aiOptionSchema.index({ status: 1 });
43
+ aiOptionSchema.index({ aiId: 1 });
44
+ aiOptionSchema.statics.build = (attrs) => {
45
+ return new AiOption(attrs);
46
+ };
47
+ const AiOption = mongoose_1.default.model('AiOption', aiOptionSchema);
48
+ exports.AiOption = AiOption;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common_ch/common",
3
- "version": "1.0.171",
3
+ "version": "1.0.173",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [