itlab-internal-services 2.6.2 → 2.6.3
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema } from 'mongoose';
|
|
1
|
+
import { Schema, VirtualTypeOptions } from 'mongoose';
|
|
2
2
|
import { HubResource } from './hub-resource.enum';
|
|
3
3
|
/**
|
|
4
4
|
* Creates virtual fields on a schema.
|
|
@@ -30,18 +30,14 @@ export declare class VirtualsFactory {
|
|
|
30
30
|
* @return {VirtualsFactory} the VirtualsFactory
|
|
31
31
|
*/
|
|
32
32
|
accounts(name: string, localField: string): VirtualsFactory;
|
|
33
|
-
/**
|
|
34
|
-
* Creates a virtual content field on the given schema, linking it to the 'content' collection.
|
|
35
|
-
*
|
|
36
|
-
* @return {VirtualsFactory} the VirtualsFactory
|
|
37
|
-
*/
|
|
38
|
-
content(): VirtualsFactory;
|
|
39
33
|
/**
|
|
40
34
|
* Creates virtual comments field on the given schema, linking it to the 'comments' collection.
|
|
41
35
|
*
|
|
42
36
|
* @return {VirtualsFactory} the VirtualsFactory
|
|
43
37
|
*/
|
|
44
38
|
comments(): VirtualsFactory;
|
|
39
|
+
virtual(name: string, options?: VirtualTypeOptions): VirtualsFactory;
|
|
40
|
+
content(): VirtualsFactory;
|
|
45
41
|
/**
|
|
46
42
|
* Creates virtual commentsCount field on the given schema, linking it to the 'comments' collection.
|
|
47
43
|
*
|
package/dist/virtuals.factory.js
CHANGED
|
@@ -49,21 +49,6 @@ class VirtualsFactory {
|
|
|
49
49
|
});
|
|
50
50
|
return this;
|
|
51
51
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Creates a virtual content field on the given schema, linking it to the 'content' collection.
|
|
54
|
-
*
|
|
55
|
-
* @return {VirtualsFactory} the VirtualsFactory
|
|
56
|
-
*/
|
|
57
|
-
content() {
|
|
58
|
-
this.schema.virtual('content', {
|
|
59
|
-
ref: 'content',
|
|
60
|
-
foreignField: '_resourceId',
|
|
61
|
-
localField: '_id',
|
|
62
|
-
match: { _resource: this.resource },
|
|
63
|
-
justOne: true,
|
|
64
|
-
});
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
52
|
/**
|
|
68
53
|
* Creates virtual comments field on the given schema, linking it to the 'comments' collection.
|
|
69
54
|
*
|
|
@@ -79,6 +64,14 @@ class VirtualsFactory {
|
|
|
79
64
|
});
|
|
80
65
|
return this;
|
|
81
66
|
}
|
|
67
|
+
virtual(name, options) {
|
|
68
|
+
this.schema.virtual(name, options);
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
content() {
|
|
72
|
+
this.schema.virtual('content');
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
82
75
|
/**
|
|
83
76
|
* Creates virtual commentsCount field on the given schema, linking it to the 'comments' collection.
|
|
84
77
|
*
|