@cool-digital-solutions/interferir-models 1.2.89 → 1.2.91
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/schemas/ai-conversation-message.schema.js +3 -2
- package/dist/schemas/ai-conversation.schema.js +3 -1
- package/dist/schemas/ai-task.schema.js +2 -1
- package/dist/schemas/competitor-grid.schema.js +5 -1
- package/dist/schemas/competitor.schema.js +1 -2
- package/dist/schemas/follow-content.schema.js +1 -1
- package/dist/schemas/image.schema.js +4 -1
- package/dist/schemas/industry.schema.js +1 -1
- package/dist/schemas/instant-research.schema.js +1 -1
- package/dist/schemas/model-indexes.js +10 -3
- package/dist/schemas/portia-article.schema.js +18 -10
- package/dist/schemas/problem.schema.js +1 -1
- package/dist/schemas/related-theme.schema.js +1 -1
- package/dist/schemas/sf-category.schema.js +1 -1
- package/dist/schemas/sf-sub-category.schema.js +1 -1
- package/dist/schemas/sf-tag.schema.js +1 -1
- package/dist/schemas/spark-use-case.schema.js +2 -2
- package/dist/schemas/startup-vector-any-entity.schema.js +7 -0
- package/dist/schemas/strategy-game-board.schema.js +0 -1
- package/dist/schemas/technology.schema.js +1 -1
- package/dist/schemas/theme.schema.js +2 -1
- package/dist/schemas/use-case.schema.js +8 -6
- package/dist/schemas/user-visit.schema.js +3 -1
- package/dist/schemas/user.schema.js +2 -2
- package/dist/types/strategy-game-board.type.d.ts +2 -3
- package/dist/types/strategy-game-board.type.js +1 -1
- package/package.json +1 -1
|
@@ -8,8 +8,8 @@ const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
|
8
8
|
const ai_conversation_message_type_1 = require("../types/ai-conversation-message.type");
|
|
9
9
|
const _config_1 = require("../config");
|
|
10
10
|
const aiConversationMessageSchema = new mongoose_1.Schema({
|
|
11
|
-
conversationId: { type: mongoose_1.Schema.Types.ObjectId, ref: 'AiConversation', required: true },
|
|
12
|
-
role: { type: String, required: true },
|
|
11
|
+
conversationId: { type: mongoose_1.Schema.Types.ObjectId, ref: 'AiConversation', required: true, index: true },
|
|
12
|
+
role: { type: String, required: true, index: true },
|
|
13
13
|
content: { type: String, default: null },
|
|
14
14
|
token: { type: Number },
|
|
15
15
|
isLiked: { type: Boolean, default: null },
|
|
@@ -37,6 +37,7 @@ const aiConversationMessageSchema = new mongoose_1.Schema({
|
|
|
37
37
|
updatedDate: Number,
|
|
38
38
|
createdDate: Number,
|
|
39
39
|
}, _config_1.schemaOptions);
|
|
40
|
+
aiConversationMessageSchema.index({ conversationId: 1, role: 1, deleteDate: 1 });
|
|
40
41
|
aiConversationMessageSchema.pre('save', function (next) {
|
|
41
42
|
const user = express_http_context_1.default.get('user');
|
|
42
43
|
const notUpdatedBy = express_http_context_1.default.get('notUpdatedBy');
|
|
@@ -7,7 +7,7 @@ const mongoose_1 = require("mongoose");
|
|
|
7
7
|
const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
8
8
|
const _config_1 = require("../config");
|
|
9
9
|
const aiConversationSchema = new mongoose_1.Schema({
|
|
10
|
-
userId: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', required: true },
|
|
10
|
+
userId: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', required: true, index: true },
|
|
11
11
|
title: { type: String, required: true },
|
|
12
12
|
summary: { type: String, required: true },
|
|
13
13
|
cost: { type: Number, required: false },
|
|
@@ -19,6 +19,8 @@ const aiConversationSchema = new mongoose_1.Schema({
|
|
|
19
19
|
updatedDate: Number,
|
|
20
20
|
createdDate: Number,
|
|
21
21
|
}, _config_1.schemaOptions);
|
|
22
|
+
aiConversationSchema.index({ updatedDate: 1, userId: 1 });
|
|
23
|
+
aiConversationSchema.index({ deleteDate: 1, userId: 1, updatedDate: -1 });
|
|
22
24
|
aiConversationSchema.pre('save', function (next) {
|
|
23
25
|
const user = express_http_context_1.default.get('user');
|
|
24
26
|
const notUpdatedBy = express_http_context_1.default.get('notUpdatedBy');
|
|
@@ -8,7 +8,7 @@ const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
|
8
8
|
const _config_1 = require("../config");
|
|
9
9
|
const ai_task_type_1 = require("../types/ai-task.type");
|
|
10
10
|
const aiTaskSchema = new mongoose_1.Schema({
|
|
11
|
-
user: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
11
|
+
user: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null, index: true },
|
|
12
12
|
type: { type: String, default: '' },
|
|
13
13
|
status: { type: String, enum: Object.values(ai_task_type_1.AITaskStatus) },
|
|
14
14
|
aiTaskSubmission: { type: mongoose_1.Schema.Types.ObjectId, ref: 'AiTaskSubmission', default: null },
|
|
@@ -27,6 +27,7 @@ const aiTaskSchema = new mongoose_1.Schema({
|
|
|
27
27
|
updatedDate: Number,
|
|
28
28
|
createdDate: Number,
|
|
29
29
|
}, _config_1.schemaOptions);
|
|
30
|
+
aiTaskSchema.index({ deleteDate: 1, user: 1 });
|
|
30
31
|
aiTaskSchema.pre('save', function (next) {
|
|
31
32
|
const user = express_http_context_1.default.get('user');
|
|
32
33
|
const notUpdatedBy = express_http_context_1.default.get('notUpdatedBy');
|
|
@@ -9,17 +9,19 @@ const _config_1 = require("../config");
|
|
|
9
9
|
const _types_1 = require("../types");
|
|
10
10
|
const competitorGridSchema = new mongoose_1.Schema({
|
|
11
11
|
competitors: {
|
|
12
|
-
type: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Competitor' }],
|
|
12
|
+
type: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Competitor', index: true }],
|
|
13
13
|
},
|
|
14
14
|
companyId: {
|
|
15
15
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
16
16
|
ref: 'Company',
|
|
17
17
|
required: true,
|
|
18
|
+
index: true,
|
|
18
19
|
},
|
|
19
20
|
userId: {
|
|
20
21
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
21
22
|
ref: 'User',
|
|
22
23
|
required: true,
|
|
24
|
+
index: true,
|
|
23
25
|
},
|
|
24
26
|
tableFields: {
|
|
25
27
|
type: [
|
|
@@ -37,12 +39,14 @@ const competitorGridSchema = new mongoose_1.Schema({
|
|
|
37
39
|
type: String,
|
|
38
40
|
enum: _types_1.AIStatus,
|
|
39
41
|
required: true,
|
|
42
|
+
index: true,
|
|
40
43
|
},
|
|
41
44
|
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
42
45
|
updatedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
43
46
|
updatedDate: { type: Number },
|
|
44
47
|
createdDate: { type: Number },
|
|
45
48
|
}, _config_1.schemaOptions);
|
|
49
|
+
competitorGridSchema.index({ competitors: 1, userId: 1, companyId: 1, aiStatus: 1 });
|
|
46
50
|
competitorGridSchema.pre('save', function (next) {
|
|
47
51
|
const user = express_http_context_1.default.get('user');
|
|
48
52
|
const notUpdatedBy = express_http_context_1.default.get('notUpdatedBy');
|
|
@@ -46,8 +46,7 @@ const competitorSchema = new mongoose_1.Schema({
|
|
|
46
46
|
updatedDate: { type: Number, index: -1 },
|
|
47
47
|
createdDate: { type: Number, index: -1 },
|
|
48
48
|
}, _config_1.schemaOptions);
|
|
49
|
-
|
|
50
|
-
competitorSchema.index({ company: 1, competitor: 1 }, { unique: true });
|
|
49
|
+
competitorSchema.index({ company: 1, competitor: 1, deleteDate: 1 }, { unique: true });
|
|
51
50
|
competitorSchema.pre('save', function (next) {
|
|
52
51
|
const user = express_http_context_1.default.get('user');
|
|
53
52
|
const notUpdatedBy = express_http_context_1.default.get('notUpdatedBy');
|
|
@@ -8,7 +8,7 @@ const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
|
8
8
|
const follow_content_type_1 = require("../types/follow-content.type");
|
|
9
9
|
const _config_1 = require("../config");
|
|
10
10
|
const followContentSchema = new mongoose_1.Schema({
|
|
11
|
-
user: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', required: [true, 'user is required'] },
|
|
11
|
+
user: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', required: [true, 'user is required'], index: true },
|
|
12
12
|
type: { type: String, enum: follow_content_type_1.FollowContentType },
|
|
13
13
|
company: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Company', default: null },
|
|
14
14
|
theme: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Theme', default: null },
|
|
@@ -8,7 +8,7 @@ const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
|
8
8
|
const image_type_1 = require("../types/image.type");
|
|
9
9
|
const _config_1 = require("../config");
|
|
10
10
|
const imageSchema = new mongoose_1.Schema({
|
|
11
|
-
fileName: { type: String, required: [true, 'fileName required'] },
|
|
11
|
+
fileName: { type: String, required: [true, 'fileName required'], index: true },
|
|
12
12
|
originalFileName: { type: String, required: [true, 'originalFileName required'] },
|
|
13
13
|
fileSize: { type: Number, required: [true, 'fileSize required'] },
|
|
14
14
|
imageFor: { type: String, enum: Object.values(image_type_1.ImageFor) },
|
|
@@ -22,11 +22,14 @@ const imageSchema = new mongoose_1.Schema({
|
|
|
22
22
|
},
|
|
23
23
|
],
|
|
24
24
|
altTag: { type: String, default: '' },
|
|
25
|
+
deleteDate: { type: Number, default: null }, // Soft delete için alan eklendi
|
|
25
26
|
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
26
27
|
updatedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
27
28
|
updatedDate: { type: Number, index: -1 },
|
|
28
29
|
createdDate: { type: Number, index: -1 },
|
|
29
30
|
}, _config_1.schemaOptions);
|
|
31
|
+
imageSchema.index({ fileName: 'text', updatedDate: -1, deleteDate: -1 });
|
|
32
|
+
imageSchema.index({ fileName: -1, updatedDate: -1, deleteDate: -1 });
|
|
30
33
|
imageSchema.pre('save', function (next) {
|
|
31
34
|
const user = express_http_context_1.default.get('user');
|
|
32
35
|
const notUpdatedBy = express_http_context_1.default.get('notUpdatedBy');
|
|
@@ -7,7 +7,7 @@ const mongoose_1 = require("mongoose");
|
|
|
7
7
|
const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
8
8
|
const _config_1 = require("../config");
|
|
9
9
|
const industrySchema = new mongoose_1.Schema({
|
|
10
|
-
name: { type: String, required: [true, 'name required!'], unique: true },
|
|
10
|
+
name: { type: String, required: [true, 'name required!'], unique: true, index: true },
|
|
11
11
|
synonyms: { type: String, default: '' },
|
|
12
12
|
description: { type: String, default: '' },
|
|
13
13
|
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
@@ -9,7 +9,7 @@ const instant_research_type_1 = require("../types/instant-research.type");
|
|
|
9
9
|
const _config_1 = require("../config");
|
|
10
10
|
const instantResearchSchema = new mongoose_1.Schema({
|
|
11
11
|
userId: { type: mongoose_1.Schema.Types.ObjectId, required: true, ref: 'User' },
|
|
12
|
-
slug: { type: String, required: [true, 'slug is required'], unique: true },
|
|
12
|
+
slug: { type: String, required: [true, 'slug is required'], unique: true, index: true },
|
|
13
13
|
brief: { type: String, required: true },
|
|
14
14
|
briefWriteUp: { type: String, default: '' },
|
|
15
15
|
titleInfo: {
|
|
@@ -3,27 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.INDEX = void 0;
|
|
4
4
|
const INDEX = [
|
|
5
5
|
{ createdDate: -1 },
|
|
6
|
-
{ type: 1 },
|
|
7
6
|
{ updatedDate: 1 },
|
|
8
7
|
{ updatedDate: -1 },
|
|
9
8
|
{ slug: 1, updatedDate: -1 },
|
|
10
9
|
{ slug: -1, updatedDate: -1 },
|
|
11
10
|
{ type: 1, updatedDate: -1 },
|
|
12
11
|
{ type: -1, updatedDate: -1 },
|
|
12
|
+
{ type: 1 },
|
|
13
13
|
{ slug: 1 },
|
|
14
14
|
{ slug: -1 },
|
|
15
15
|
{ status: 1 },
|
|
16
16
|
{ status: -1 },
|
|
17
|
-
{ status: 1, updatedDate: -1 },
|
|
18
17
|
{ deleteDate: 1 },
|
|
19
18
|
{ name: 1 },
|
|
20
19
|
{ website: 1 },
|
|
21
20
|
{ websiteBaseDomain: 1 },
|
|
22
21
|
{ profileDetailUrls: 1 },
|
|
23
|
-
{ name: 1, website: 1 },
|
|
24
22
|
{ 'portfolios.company': 1 },
|
|
25
23
|
{ trustedByList: 1 },
|
|
26
24
|
{ 'finance.investors': 1 },
|
|
27
25
|
{ 'finance.leadInvestors': 1 },
|
|
26
|
+
{ status: 1, updatedDate: -1 },
|
|
27
|
+
{ createdDate: -1 },
|
|
28
|
+
{ name: 1, website: 1 },
|
|
29
|
+
{ acquiredBy: 1 },
|
|
30
|
+
{ name: 1, headquartersLocation: 1, countryCode: 1 },
|
|
31
|
+
{ investmentPortfolio: 1 },
|
|
32
|
+
{ 'investmentPortfolio.portfolioCompanyAnalyses.company': 1 },
|
|
33
|
+
{ exits: 1 },
|
|
34
|
+
{ name: 'text', website: 'text', slug: 'text', type: 'text' },
|
|
28
35
|
];
|
|
29
36
|
exports.INDEX = INDEX;
|
|
@@ -29,11 +29,11 @@ const portiaArticleSchema = new mongoose_1.Schema({
|
|
|
29
29
|
enum: Object.values(portia_article_type_1.PortiaArticleLanguages),
|
|
30
30
|
default: portia_article_type_1.PortiaArticleLanguages.ENGLISH,
|
|
31
31
|
},
|
|
32
|
-
sourceDomain: { type: String, default: '' },
|
|
32
|
+
sourceDomain: { type: String, default: '', index: true },
|
|
33
33
|
hyperlinks: [{ type: String, default: '' }],
|
|
34
34
|
analysisResult: {
|
|
35
35
|
type: {
|
|
36
|
-
categories: [{ type: String, default: '' }],
|
|
36
|
+
categories: [{ type: String, default: '', index: true }],
|
|
37
37
|
summary: {
|
|
38
38
|
type: String,
|
|
39
39
|
default: '',
|
|
@@ -69,7 +69,13 @@ const portiaArticleSchema = new mongoose_1.Schema({
|
|
|
69
69
|
},
|
|
70
70
|
],
|
|
71
71
|
useCases: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'UseCase' }],
|
|
72
|
-
status: {
|
|
72
|
+
status: {
|
|
73
|
+
type: String,
|
|
74
|
+
enum: Object.values(portia_article_type_1.PortiaArticleStatus),
|
|
75
|
+
required: [true, 'status is required!'],
|
|
76
|
+
default: portia_article_type_1.PortiaArticleStatus.PUBLISH,
|
|
77
|
+
index: true,
|
|
78
|
+
},
|
|
73
79
|
sfIndustries: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Industry' }],
|
|
74
80
|
sfTechnologies: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Technology' }],
|
|
75
81
|
sfCategories: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'SFCategory' }],
|
|
@@ -78,18 +84,24 @@ const portiaArticleSchema = new mongoose_1.Schema({
|
|
|
78
84
|
portiaApiResults: [{ message: { type: String, default: '' } }],
|
|
79
85
|
similarArticleUrls: [{ type: String, required: false, default: [] }],
|
|
80
86
|
similarArticleCount: { type: Number, default: 0 },
|
|
81
|
-
aiTaskResearchManagerOutputs: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'AiTaskResearchManagerOutput' }],
|
|
87
|
+
aiTaskResearchManagerOutputs: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'AiTaskResearchManagerOutput', index: true }],
|
|
82
88
|
aiTasks: [
|
|
83
89
|
{
|
|
84
90
|
aiTask: { type: mongoose_1.Schema.Types.ObjectId, ref: 'AiTask' },
|
|
85
91
|
score: { type: Number, default: 0 },
|
|
86
92
|
},
|
|
87
93
|
],
|
|
88
|
-
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
89
|
-
updatedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
94
|
+
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null, index: true },
|
|
95
|
+
updatedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null, index: true },
|
|
90
96
|
updatedDate: { type: Number, index: -1 },
|
|
91
97
|
createdDate: { type: Number, index: -1 },
|
|
92
98
|
}, _config_1.schemaOptions);
|
|
99
|
+
portiaArticleSchema.index({
|
|
100
|
+
title: -1,
|
|
101
|
+
'analysisResult.summary': -1,
|
|
102
|
+
});
|
|
103
|
+
portiaArticleSchema.index({ createdBy: 1, updatedBy: 1 });
|
|
104
|
+
portiaArticleSchema.index({ status: 1, updatedDate: -1 });
|
|
93
105
|
portiaArticleSchema.pre('save', function (next) {
|
|
94
106
|
const user = express_http_context_1.default.get('user');
|
|
95
107
|
const notUpdatedBy = express_http_context_1.default.get('notUpdatedBy');
|
|
@@ -108,8 +120,4 @@ portiaArticleSchema.pre('findOneAndUpdate', function (next) {
|
|
|
108
120
|
this._update.updatedBy = user._id;
|
|
109
121
|
next();
|
|
110
122
|
});
|
|
111
|
-
portiaArticleSchema.index({
|
|
112
|
-
title: -1,
|
|
113
|
-
'analysisResult.summary': -1,
|
|
114
|
-
});
|
|
115
123
|
exports.default = portiaArticleSchema;
|
|
@@ -8,7 +8,7 @@ const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
|
8
8
|
const _config_1 = require("../config");
|
|
9
9
|
const problemSchema = new mongoose_1.Schema({
|
|
10
10
|
title: { type: String },
|
|
11
|
-
slug: { type: String, required: [true, 'slug is required!'], unique: true },
|
|
11
|
+
slug: { type: String, required: [true, 'slug is required!'], unique: true, index: true },
|
|
12
12
|
content: { type: String },
|
|
13
13
|
contentHTML: { type: String },
|
|
14
14
|
themeList: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Theme' }],
|
|
@@ -7,7 +7,7 @@ const mongoose_1 = require("mongoose");
|
|
|
7
7
|
const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
8
8
|
const _config_1 = require("../config");
|
|
9
9
|
const relatedThemeSchema = new mongoose_1.Schema({
|
|
10
|
-
company: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Company', default: null, unique: true },
|
|
10
|
+
company: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Company', default: null, unique: true, index: true },
|
|
11
11
|
themes: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Theme', default: null }],
|
|
12
12
|
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
13
13
|
updatedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
@@ -7,7 +7,7 @@ const mongoose_1 = require("mongoose");
|
|
|
7
7
|
const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
8
8
|
const _config_1 = require("../config");
|
|
9
9
|
const sfCategorySchema = new mongoose_1.Schema({
|
|
10
|
-
name: { type: String, required: [true, 'name required!'], unique: true },
|
|
10
|
+
name: { type: String, required: [true, 'name required!'], unique: true, index: true },
|
|
11
11
|
synonyms: { type: String, default: '' },
|
|
12
12
|
description: { type: String, default: '' },
|
|
13
13
|
industry: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Industry', default: null },
|
|
@@ -7,7 +7,7 @@ const mongoose_1 = require("mongoose");
|
|
|
7
7
|
const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
8
8
|
const _config_1 = require("../config");
|
|
9
9
|
const sfSubCategorySchema = new mongoose_1.Schema({
|
|
10
|
-
name: { type: String, required: [true, 'name required!'], unique: true },
|
|
10
|
+
name: { type: String, required: [true, 'name required!'], unique: true, index: true },
|
|
11
11
|
synonyms: { type: String, default: '' },
|
|
12
12
|
description: { type: String, default: '' },
|
|
13
13
|
category: { type: mongoose_1.Schema.Types.ObjectId, ref: 'SFCategory', default: null },
|
|
@@ -7,7 +7,7 @@ const mongoose_1 = require("mongoose");
|
|
|
7
7
|
const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
8
8
|
const _config_1 = require("../config");
|
|
9
9
|
const sfTagSchema = new mongoose_1.Schema({
|
|
10
|
-
name: { type: String, required: [true, 'name required!'], unique: true },
|
|
10
|
+
name: { type: String, required: [true, 'name required!'], unique: true, index: true },
|
|
11
11
|
synonyms: { type: String, default: '' },
|
|
12
12
|
description: { type: String, default: '' },
|
|
13
13
|
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
@@ -9,8 +9,8 @@ const spark_type_1 = require("../types/spark.type");
|
|
|
9
9
|
const spark_use_case_type_1 = require("../types/spark-use-case.type");
|
|
10
10
|
const _config_1 = require("../config");
|
|
11
11
|
const sparkUseCaseSchema = new mongoose_1.Schema({
|
|
12
|
-
owner: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
13
|
-
slug: { type: String, required: [true, 'slug is required!'], unique: true },
|
|
12
|
+
owner: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null, index: true },
|
|
13
|
+
slug: { type: String, required: [true, 'slug is required!'], unique: true, index: true },
|
|
14
14
|
spark: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Spark', index: 1, required: [true, 'spark is required'] }],
|
|
15
15
|
priority: { type: String, required: [true, 'priority is required'], enum: Object.values(spark_type_1.SparkPriorityList) },
|
|
16
16
|
priorityLevel: { type: Number, default: 0 },
|
|
@@ -22,6 +22,13 @@ const startupAnyEntitySchema = new mongoose_1.Schema({
|
|
|
22
22
|
updatedDate: { type: Number, index: -1 },
|
|
23
23
|
createdDate: { type: Number, index: -1 },
|
|
24
24
|
}, _config_1.schemaOptions);
|
|
25
|
+
startupAnyEntitySchema.index({
|
|
26
|
+
resultModel: 1,
|
|
27
|
+
requesterId: 1,
|
|
28
|
+
requestModel: 1,
|
|
29
|
+
requesterType: 1,
|
|
30
|
+
requestTitle: 1,
|
|
31
|
+
});
|
|
25
32
|
startupAnyEntitySchema.pre('save', function (next) {
|
|
26
33
|
const user = express_http_context_1.default.get('user');
|
|
27
34
|
const notUpdatedBy = express_http_context_1.default.get('notUpdatedBy');
|
|
@@ -12,7 +12,6 @@ const strategyGameBoardSchema = new mongoose_1.Schema({
|
|
|
12
12
|
user: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', required: true },
|
|
13
13
|
contentType: { type: String, enum: Object.values(strategy_game_board_type_1.GameBoardContentType), required: true },
|
|
14
14
|
contentId: { type: mongoose_1.Schema.Types.ObjectId, required: true },
|
|
15
|
-
problemId: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Problem', default: null },
|
|
16
15
|
categories: { type: [String], enum: Object.values(strategy_game_board_type_1.GameBoardCategory), required: true },
|
|
17
16
|
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
18
17
|
updatedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
@@ -7,7 +7,7 @@ const mongoose_1 = require("mongoose");
|
|
|
7
7
|
const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
8
8
|
const _config_1 = require("../config");
|
|
9
9
|
const technologySchema = new mongoose_1.Schema({
|
|
10
|
-
name: { type: String, required: [true, 'name required!'], unique: true },
|
|
10
|
+
name: { type: String, required: [true, 'name required!'], unique: true, index: true },
|
|
11
11
|
synonyms: { type: String, default: '' },
|
|
12
12
|
description: { type: String, default: '' },
|
|
13
13
|
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
@@ -32,7 +32,7 @@ const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
|
32
32
|
const _config_1 = require("../config");
|
|
33
33
|
const themeSchema = new mongoose_1.Schema({
|
|
34
34
|
title: { type: String, required: [true, 'title is required!'] },
|
|
35
|
-
slug: { type: String, required: [true, 'slug is required!'], unique: true },
|
|
35
|
+
slug: { type: String, required: [true, 'slug is required!'], unique: true, index: true },
|
|
36
36
|
description: { type: String, default: '' },
|
|
37
37
|
descriptionHTML: { type: String, default: '' },
|
|
38
38
|
contents: [{ title: { type: String }, description: { type: String } }],
|
|
@@ -91,6 +91,7 @@ const themeSchema = new mongoose_1.Schema({
|
|
|
91
91
|
updatedDate: { type: Number, index: -1 },
|
|
92
92
|
createdDate: { type: Number, index: -1 },
|
|
93
93
|
}, _config_1.schemaOptions);
|
|
94
|
+
themeSchema.index({ slug: 1, deleteDate: 1 }, { unique: true });
|
|
94
95
|
const excludeNonNullField = (schema, options) => {
|
|
95
96
|
const { fieldName } = options;
|
|
96
97
|
const addCondition = function (next) {
|
|
@@ -7,7 +7,7 @@ const mongoose_1 = require("mongoose");
|
|
|
7
7
|
const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
8
8
|
const _config_1 = require("../config");
|
|
9
9
|
const useCaseSchema = new mongoose_1.Schema({
|
|
10
|
-
slug: { type: String, required: [true, 'slug is required!'], unique: true },
|
|
10
|
+
slug: { type: String, required: [true, 'slug is required!'], unique: true, index: true },
|
|
11
11
|
status: {
|
|
12
12
|
type: String,
|
|
13
13
|
enum: Object.values(_config_1.ContentStatus),
|
|
@@ -27,7 +27,7 @@ const useCaseSchema = new mongoose_1.Schema({
|
|
|
27
27
|
importance: { type: String, required: [true, 'importance is required!'] },
|
|
28
28
|
importanceHTML: { type: String, default: '' },
|
|
29
29
|
themeList: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Theme', index: true }],
|
|
30
|
-
problemList: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Problem' }],
|
|
30
|
+
problemList: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Problem', index: true }],
|
|
31
31
|
source: {
|
|
32
32
|
url: { type: String, default: '' },
|
|
33
33
|
freeText: { type: String, default: '' },
|
|
@@ -49,10 +49,10 @@ const useCaseSchema = new mongoose_1.Schema({
|
|
|
49
49
|
dislikeCount: { type: Number, default: 0 },
|
|
50
50
|
sparkUseCase: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'SparkUseCase' }],
|
|
51
51
|
fromEmptySparkUseCase: { type: Boolean, default: false },
|
|
52
|
-
sfIndustries: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Industry' }],
|
|
53
|
-
sfTechnologies: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Technology' }],
|
|
54
|
-
sfCategories: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'SFCategory' }],
|
|
55
|
-
sfSubCategories: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'SFSubCategory' }],
|
|
52
|
+
sfIndustries: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Industry', index: true }],
|
|
53
|
+
sfTechnologies: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Technology', index: true }],
|
|
54
|
+
sfCategories: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'SFCategory', index: true }],
|
|
55
|
+
sfSubCategories: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'SFSubCategory', index: true }],
|
|
56
56
|
sfTags: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'SFTag' }],
|
|
57
57
|
instantResearches: [
|
|
58
58
|
{
|
|
@@ -74,6 +74,8 @@ const useCaseSchema = new mongoose_1.Schema({
|
|
|
74
74
|
updatedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
75
75
|
updatedDate: Number,
|
|
76
76
|
}, _config_1.schemaOptions);
|
|
77
|
+
useCaseSchema.index({ 'actors._id': 1, 'actors.name': 1 });
|
|
78
|
+
useCaseSchema.index({ 'solutionProviderList._id': 1, name: 1 });
|
|
77
79
|
useCaseSchema.pre('save', function (next) {
|
|
78
80
|
const user = express_http_context_1.default.get('user');
|
|
79
81
|
const notUpdatedBy = express_http_context_1.default.get('notUpdatedBy');
|
|
@@ -8,7 +8,7 @@ const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
|
8
8
|
const user_visit_type_1 = require("../types/user-visit.type");
|
|
9
9
|
const _config_1 = require("../config");
|
|
10
10
|
const userVisitSchema = new mongoose_1.Schema({
|
|
11
|
-
userId: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
11
|
+
userId: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null, index: true },
|
|
12
12
|
model: { type: mongoose_1.Schema.Types.ObjectId, default: null },
|
|
13
13
|
type: { type: String, enum: user_visit_type_1.UserVisitType, required: [true, 'type is required'] },
|
|
14
14
|
incomingURL: { type: String, default: '' },
|
|
@@ -17,6 +17,8 @@ const userVisitSchema = new mongoose_1.Schema({
|
|
|
17
17
|
updatedDate: { type: Number, index: -1 },
|
|
18
18
|
createdDate: { type: Number, index: -1 },
|
|
19
19
|
}, _config_1.schemaOptions);
|
|
20
|
+
userVisitSchema.index({ updatedDate: -1, deleteDate: 1 });
|
|
21
|
+
userVisitSchema.index({ userId: 1, deleteDate: 1, updatedDate: -1 });
|
|
20
22
|
userVisitSchema.pre('save', function (next) {
|
|
21
23
|
const user = express_http_context_1.default.get('user');
|
|
22
24
|
const notUpdatedBy = express_http_context_1.default.get('notUpdatedBy');
|
|
@@ -8,9 +8,9 @@ const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
|
8
8
|
const user_type_1 = require("../types/user.type");
|
|
9
9
|
const _config_1 = require("../config");
|
|
10
10
|
const userSchema = new mongoose_1.Schema({
|
|
11
|
-
email: { type: String, required: [true, 'email required!'] },
|
|
11
|
+
email: { type: String, required: [true, 'email required!'], unique: true, index: true },
|
|
12
12
|
password: { type: String, required: false },
|
|
13
|
-
name: { type: String, default: '' },
|
|
13
|
+
name: { type: String, default: '', index: true },
|
|
14
14
|
surname: { type: String, default: '' },
|
|
15
15
|
profileImage: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Image', default: null },
|
|
16
16
|
industries: [{ type: String }],
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import { Types } from 'mongoose';
|
|
26
26
|
import { BaseModel, BaseSchema } from '../config';
|
|
27
|
-
import { IUser, ITeam
|
|
27
|
+
import { IUser, ITeam } from './';
|
|
28
28
|
export declare enum GameBoardCategory {
|
|
29
29
|
BUILD = "build",
|
|
30
30
|
PARTNER = "partner",
|
|
@@ -33,7 +33,7 @@ export declare enum GameBoardCategory {
|
|
|
33
33
|
}
|
|
34
34
|
export declare enum GameBoardContentType {
|
|
35
35
|
AGENT_TASK = "agentTask",
|
|
36
|
-
|
|
36
|
+
Problem = "problem",
|
|
37
37
|
COMPANY = "company"
|
|
38
38
|
}
|
|
39
39
|
export interface IStrategyGameBoard extends BaseSchema {
|
|
@@ -41,7 +41,6 @@ export interface IStrategyGameBoard extends BaseSchema {
|
|
|
41
41
|
user: Types.ObjectId | IUser;
|
|
42
42
|
contentType: GameBoardContentType;
|
|
43
43
|
contentId: Types.ObjectId;
|
|
44
|
-
problemId: Types.ObjectId | IProblem;
|
|
45
44
|
categories: GameBoardCategory[];
|
|
46
45
|
}
|
|
47
46
|
export interface IStrategyGameBoardModel extends BaseModel<IStrategyGameBoard> {
|
|
@@ -11,6 +11,6 @@ var GameBoardCategory;
|
|
|
11
11
|
var GameBoardContentType;
|
|
12
12
|
(function (GameBoardContentType) {
|
|
13
13
|
GameBoardContentType["AGENT_TASK"] = "agentTask";
|
|
14
|
-
GameBoardContentType["
|
|
14
|
+
GameBoardContentType["Problem"] = "problem";
|
|
15
15
|
GameBoardContentType["COMPANY"] = "company";
|
|
16
16
|
})(GameBoardContentType || (exports.GameBoardContentType = GameBoardContentType = {}));
|