@unchainedshop/core-enrollments 5.0.0-alpha.1 → 5.0.0-alpha.2
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 { mongodb, buildDbIndexes
|
|
1
|
+
import { mongodb, buildDbIndexes } from '@unchainedshop/mongodb';
|
|
2
2
|
import {} from '@unchainedshop/mongodb';
|
|
3
3
|
export const EnrollmentStatus = {
|
|
4
4
|
INITIAL: 'INITIAL',
|
|
@@ -8,34 +8,33 @@ export const EnrollmentStatus = {
|
|
|
8
8
|
};
|
|
9
9
|
export const EnrollmentsCollection = async (db) => {
|
|
10
10
|
const Enrollments = db.collection('enrollments');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
status: 1,
|
|
30
|
-
},
|
|
31
|
-
name: 'enrollment_fulltext_search',
|
|
11
|
+
await buildDbIndexes(Enrollments, [
|
|
12
|
+
{
|
|
13
|
+
index: {
|
|
14
|
+
_id: 'text',
|
|
15
|
+
userId: 'text',
|
|
16
|
+
enrollmentNumber: 'text',
|
|
17
|
+
status: 'text',
|
|
18
|
+
'contact.telNumber': 'text',
|
|
19
|
+
'contact.emailAddress': 'text',
|
|
20
|
+
},
|
|
21
|
+
options: {
|
|
22
|
+
weights: {
|
|
23
|
+
_id: 8,
|
|
24
|
+
userId: 3,
|
|
25
|
+
enrollmentNumber: 6,
|
|
26
|
+
'contact.telNumber': 5,
|
|
27
|
+
'contact.emailAddress': 4,
|
|
28
|
+
status: 1,
|
|
32
29
|
},
|
|
30
|
+
name: 'enrollment_fulltext_search',
|
|
33
31
|
},
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
},
|
|
33
|
+
]);
|
|
36
34
|
await buildDbIndexes(Enrollments, [
|
|
37
|
-
{ index: {
|
|
38
|
-
{ index: {
|
|
35
|
+
{ index: { 'periods.orderId': 1 } },
|
|
36
|
+
{ index: { userId: 1, status: 1 } },
|
|
37
|
+
{ index: { productId: 1, status: 1 } },
|
|
39
38
|
{ index: { status: 1 } },
|
|
40
39
|
{ index: { enrollmentNumber: 1 } },
|
|
41
40
|
]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SortDirection } from '@unchainedshop/utils';
|
|
2
2
|
import { EnrollmentStatus, } from "../db/EnrollmentsCollection.js";
|
|
3
3
|
import { emit, registerEvents } from '@unchainedshop/events';
|
|
4
|
-
import { generateDbFilterById, buildSortOptions, mongodb, generateDbObjectId,
|
|
4
|
+
import { generateDbFilterById, buildSortOptions, mongodb, generateDbObjectId, } from '@unchainedshop/mongodb';
|
|
5
5
|
import { EnrollmentsCollection } from "../db/EnrollmentsCollection.js";
|
|
6
6
|
import { enrollmentsSettings } from "../enrollments-settings.js";
|
|
7
7
|
const ENROLLMENT_EVENTS = [
|
|
@@ -19,7 +19,6 @@ export const buildFindSelector = ({ queryString, status, userId }) => {
|
|
|
19
19
|
if (userId)
|
|
20
20
|
selector.userId = userId;
|
|
21
21
|
if (queryString) {
|
|
22
|
-
assertDocumentDBCompatMode();
|
|
23
22
|
selector.$text = { $search: queryString };
|
|
24
23
|
}
|
|
25
24
|
return selector;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-enrollments",
|
|
3
3
|
"description": "Subscription and recurring billing module for the Unchained Engine",
|
|
4
|
-
"version": "5.0.0-alpha.
|
|
4
|
+
"version": "5.0.0-alpha.2",
|
|
5
5
|
"main": "lib/enrollments-index.js",
|
|
6
6
|
"types": "lib/enrollments-index.d.ts",
|
|
7
7
|
"type": "module",
|