@cool-digital-solutions/interferir-models 1.0.89 → 1.0.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.
|
@@ -38,7 +38,7 @@ competitorSchema.pre('findOneAndUpdate', function (next) {
|
|
|
38
38
|
const notCreatedBy = express_http_context_1.default.get('notCreatedBy');
|
|
39
39
|
if (user)
|
|
40
40
|
this._update.updatedBy = user._id;
|
|
41
|
-
if (!notCreatedBy && this?.options?.upsert && !this.createdBy) {
|
|
41
|
+
if (!notCreatedBy && this?.options?.upsert && !this.createdBy && user) {
|
|
42
42
|
this._update.createdBy = user._id;
|
|
43
43
|
}
|
|
44
44
|
next();
|
|
@@ -9,6 +9,8 @@ const _config_1 = require("../config");
|
|
|
9
9
|
const instantResearchSchema = new mongoose_1.Schema({
|
|
10
10
|
company: { type: mongoose_1.Schema.Types.ObjectId, required: true, ref: 'Company' },
|
|
11
11
|
investor: { type: mongoose_1.Schema.Types.ObjectId, required: true, ref: 'Company' },
|
|
12
|
+
addedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
13
|
+
score: { score: { type: Number, required: true }, reason: { type: String, required: true } },
|
|
12
14
|
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
13
15
|
updatedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
14
16
|
updatedDate: { type: Number, index: -1 },
|
|
@@ -20,6 +22,8 @@ instantResearchSchema.pre('save', function (next) {
|
|
|
20
22
|
if (user) {
|
|
21
23
|
if (!this.createdBy)
|
|
22
24
|
this.createdBy = user._id;
|
|
25
|
+
if (!this.addedBy)
|
|
26
|
+
this.addedBy = user._id;
|
|
23
27
|
if (!notUpdatedBy)
|
|
24
28
|
this.updatedBy = user._id;
|
|
25
29
|
}
|
|
@@ -24,9 +24,15 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import { Types } from 'mongoose';
|
|
26
26
|
import { BaseModel, BaseSchema } from '../config';
|
|
27
|
+
export interface scoreDetail {
|
|
28
|
+
score: number;
|
|
29
|
+
reason: string;
|
|
30
|
+
}
|
|
27
31
|
export interface IInvestor extends BaseSchema {
|
|
28
32
|
company: Types.ObjectId;
|
|
29
33
|
investor: Types.ObjectId;
|
|
34
|
+
score: scoreDetail;
|
|
35
|
+
addedBy?: Types.ObjectId;
|
|
30
36
|
}
|
|
31
37
|
export interface IInvestorModel extends BaseModel<IInvestor> {
|
|
32
38
|
}
|