@chevre/domain 22.6.0-alpha.18 → 22.6.0-alpha.19
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/example/src/chevre/reIndex.ts +23 -0
- package/lib/chevre/repo/mongoose/schemas/civicStructure.js +9 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +9 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +24 -19
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +16 -11
- package/lib/chevre/repo/mongoose/schemas/place.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +1 -1
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
mongoose.Model.on('index', (...args) => {
|
|
7
|
+
console.error('******** index event emitted. ********\n', args);
|
|
8
|
+
});
|
|
9
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
10
|
+
|
|
11
|
+
async function main() {
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
+
|
|
14
|
+
await chevre.repository.CreativeWork.createInstance(mongoose.connection);
|
|
15
|
+
await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
|
|
16
|
+
await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
|
|
17
|
+
await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
|
|
18
|
+
console.log('success!');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
main()
|
|
22
|
+
.then()
|
|
23
|
+
.catch(console.error);
|
|
@@ -20,7 +20,7 @@ const schemaDefinition = {
|
|
|
20
20
|
required: true
|
|
21
21
|
},
|
|
22
22
|
name: mongoose_1.SchemaTypes.Mixed,
|
|
23
|
-
branchCode: String,
|
|
23
|
+
branchCode: { type: String, required: true },
|
|
24
24
|
hasEntranceGate: [mongoose_1.SchemaTypes.Mixed],
|
|
25
25
|
hasPOS: [mongoose_1.SchemaTypes.Mixed],
|
|
26
26
|
telephone: String,
|
|
@@ -110,6 +110,14 @@ const indexes = [
|
|
|
110
110
|
additionalProperty: { $exists: true }
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
// add unique index(2024-11-12~)
|
|
116
|
+
{ 'project.id': 1, branchCode: 1 },
|
|
117
|
+
{
|
|
118
|
+
unique: true,
|
|
119
|
+
name: 'uniqueBranchCode'
|
|
120
|
+
}
|
|
113
121
|
]
|
|
114
122
|
];
|
|
115
123
|
exports.indexes = indexes;
|
|
@@ -12,7 +12,7 @@ const schemaDefinition = {
|
|
|
12
12
|
type: String,
|
|
13
13
|
required: true
|
|
14
14
|
},
|
|
15
|
-
identifier: String,
|
|
15
|
+
identifier: { type: String, required: true },
|
|
16
16
|
name: mongoose_1.SchemaTypes.Mixed,
|
|
17
17
|
// alternateName: String,
|
|
18
18
|
alternativeHeadline: String,
|
|
@@ -146,6 +146,14 @@ const indexes = [
|
|
|
146
146
|
additionalProperty: { $exists: true }
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
+
],
|
|
150
|
+
[
|
|
151
|
+
// add unique index(2024-11-12~)
|
|
152
|
+
{ 'project.id': 1, identifier: 1 },
|
|
153
|
+
{
|
|
154
|
+
unique: true,
|
|
155
|
+
name: 'uniqueIdentifier'
|
|
156
|
+
}
|
|
149
157
|
]
|
|
150
158
|
];
|
|
151
159
|
exports.indexes = indexes;
|
|
@@ -9,6 +9,6 @@ type IModel = Model<IDocType>;
|
|
|
9
9
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
10
10
|
type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
|
|
11
11
|
declare const modelName = "OfferCatalog";
|
|
12
|
-
declare function createSchema(): ISchema;
|
|
13
12
|
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
13
|
+
declare function createSchema(): ISchema;
|
|
14
14
|
export { createSchema, IModel, indexes, modelName };
|
|
@@ -53,26 +53,7 @@ const schemaOptions = {
|
|
|
53
53
|
versionKey: false
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
/**
|
|
57
|
-
* オファーカタログスキーマ
|
|
58
|
-
*/
|
|
59
|
-
let schema;
|
|
60
|
-
function createSchema() {
|
|
61
|
-
if (schema === undefined) {
|
|
62
|
-
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
63
|
-
}
|
|
64
|
-
return schema;
|
|
65
|
-
}
|
|
66
|
-
exports.createSchema = createSchema;
|
|
67
56
|
const indexes = [
|
|
68
|
-
[
|
|
69
|
-
{ createdAt: 1 },
|
|
70
|
-
{ name: 'searchByCreatedAt' }
|
|
71
|
-
],
|
|
72
|
-
[
|
|
73
|
-
{ updatedAt: 1 },
|
|
74
|
-
{ name: 'searchByUpdatedAt' }
|
|
75
|
-
],
|
|
76
57
|
[
|
|
77
58
|
{ identifier: 1 },
|
|
78
59
|
{
|
|
@@ -129,6 +110,30 @@ const indexes = [
|
|
|
129
110
|
additionalProperty: { $exists: true }
|
|
130
111
|
}
|
|
131
112
|
}
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
// add unique index(2024-11-12~)
|
|
116
|
+
{ 'project.id': 1, identifier: 1 },
|
|
117
|
+
{
|
|
118
|
+
unique: true,
|
|
119
|
+
name: 'uniqueIdentifier'
|
|
120
|
+
}
|
|
132
121
|
]
|
|
133
122
|
];
|
|
134
123
|
exports.indexes = indexes;
|
|
124
|
+
/**
|
|
125
|
+
* オファーカタログスキーマ
|
|
126
|
+
*/
|
|
127
|
+
let schema;
|
|
128
|
+
function createSchema() {
|
|
129
|
+
if (schema === undefined) {
|
|
130
|
+
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
131
|
+
if (settings_1.MONGO_AUTO_INDEX) {
|
|
132
|
+
indexes.forEach((indexParams) => {
|
|
133
|
+
schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return schema;
|
|
138
|
+
}
|
|
139
|
+
exports.createSchema = createSchema;
|
|
@@ -9,6 +9,6 @@ type IModel = Model<IDocType>;
|
|
|
9
9
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
10
10
|
type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
|
|
11
11
|
declare const modelName = "OfferCatalogItem";
|
|
12
|
-
declare function createSchema(): ISchema;
|
|
13
12
|
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
13
|
+
declare function createSchema(): ISchema;
|
|
14
14
|
export { createSchema, IModel, indexes, modelName };
|
|
@@ -51,6 +51,17 @@ const schemaOptions = {
|
|
|
51
51
|
versionKey: false
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
+
const indexes = [
|
|
55
|
+
[
|
|
56
|
+
// add unique index(2024-11-12~)
|
|
57
|
+
{ 'project.id': 1, identifier: 1 },
|
|
58
|
+
{
|
|
59
|
+
unique: true,
|
|
60
|
+
name: 'uniqueIdentifier'
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
];
|
|
64
|
+
exports.indexes = indexes;
|
|
54
65
|
/**
|
|
55
66
|
* サブカタログスキーマ
|
|
56
67
|
*/
|
|
@@ -58,18 +69,12 @@ let schema;
|
|
|
58
69
|
function createSchema() {
|
|
59
70
|
if (schema === undefined) {
|
|
60
71
|
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
72
|
+
if (settings_1.MONGO_AUTO_INDEX) {
|
|
73
|
+
indexes.forEach((indexParams) => {
|
|
74
|
+
schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
61
77
|
}
|
|
62
78
|
return schema;
|
|
63
79
|
}
|
|
64
80
|
exports.createSchema = createSchema;
|
|
65
|
-
const indexes = [
|
|
66
|
-
[
|
|
67
|
-
{ createdAt: 1 },
|
|
68
|
-
{ name: 'searchByCreatedAt' }
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
{ updatedAt: 1 },
|
|
72
|
-
{ name: 'searchByUpdatedAt' }
|
|
73
|
-
]
|
|
74
|
-
];
|
|
75
|
-
exports.indexes = indexes;
|
|
@@ -23,7 +23,7 @@ const schemaDefinition = {
|
|
|
23
23
|
name: mongoose_1.SchemaTypes.Mixed,
|
|
24
24
|
description: mongoose_1.SchemaTypes.Mixed,
|
|
25
25
|
address: mongoose_1.SchemaTypes.Mixed,
|
|
26
|
-
branchCode: String,
|
|
26
|
+
branchCode: { type: String, required: true },
|
|
27
27
|
containedInPlace: mongoose_1.SchemaTypes.Mixed,
|
|
28
28
|
containsPlace: [mongoose_1.SchemaTypes.Mixed],
|
|
29
29
|
maximumAttendeeCapacity: Number,
|
|
@@ -29,7 +29,7 @@ function onReservationUsed(attendedReservation, action) {
|
|
|
29
29
|
const informTaskRunsAt = now;
|
|
30
30
|
// support notification.reservation.IUseAction(2024-11-11~)
|
|
31
31
|
let reservation4inform;
|
|
32
|
-
if (settings.
|
|
32
|
+
if (settings.useNotificationUseAction) {
|
|
33
33
|
reservation4inform = Object.assign({ typeOf: action.typeOf, project: action.project, id: action.id, object: {
|
|
34
34
|
typeOf: attendedReservation.typeOf,
|
|
35
35
|
id: attendedReservation.id,
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ interface IOptions {
|
|
|
82
82
|
useAssetTransactionSyncProcessing: boolean;
|
|
83
83
|
useExperimentalFeature: boolean;
|
|
84
84
|
useNotificationCheckedInAsPackage?: boolean;
|
|
85
|
+
useNotificationUseAction?: boolean;
|
|
85
86
|
notification: IWebhookSettings;
|
|
86
87
|
}
|
|
87
88
|
/**
|
|
@@ -141,6 +142,7 @@ declare class Settings {
|
|
|
141
142
|
readonly useAssetTransactionSyncProcessing: boolean;
|
|
142
143
|
readonly useExperimentalFeature: boolean;
|
|
143
144
|
readonly useNotificationCheckedInAsPackage: boolean;
|
|
145
|
+
readonly useNotificationUseAction: boolean;
|
|
144
146
|
/**
|
|
145
147
|
* 通知設定
|
|
146
148
|
*/
|
package/lib/chevre/settings.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "AggregationSettings", { enumerable: true, get: f
|
|
|
8
8
|
*/
|
|
9
9
|
class Settings {
|
|
10
10
|
constructor(options) {
|
|
11
|
-
const { onEventChanged, onOrderStatusChanged, onResourceUpdated, onReservationStatusChanged, userPoolIdOld, userPoolIdNew, abortedTasksWithoutReport, numTryConfirmReserveTransaction, transaction, defaultSenderEmail, deliverOrderLimit, coa, gmo, movieticketReserve, useAssetTransactionSyncProcessing, useExperimentalFeature, useNotificationCheckedInAsPackage, notification } = options;
|
|
11
|
+
const { onEventChanged, onOrderStatusChanged, onResourceUpdated, onReservationStatusChanged, userPoolIdOld, userPoolIdNew, abortedTasksWithoutReport, numTryConfirmReserveTransaction, transaction, defaultSenderEmail, deliverOrderLimit, coa, gmo, movieticketReserve, useAssetTransactionSyncProcessing, useExperimentalFeature, useNotificationCheckedInAsPackage, useNotificationUseAction, notification } = options;
|
|
12
12
|
this.onEventChanged = onEventChanged;
|
|
13
13
|
this.onOrderStatusChanged = onOrderStatusChanged;
|
|
14
14
|
this.onResourceUpdated = onResourceUpdated;
|
|
@@ -26,6 +26,7 @@ class Settings {
|
|
|
26
26
|
this.useAssetTransactionSyncProcessing = useAssetTransactionSyncProcessing;
|
|
27
27
|
this.useExperimentalFeature = useExperimentalFeature;
|
|
28
28
|
this.useNotificationCheckedInAsPackage = useNotificationCheckedInAsPackage === true;
|
|
29
|
+
this.useNotificationUseAction = useNotificationUseAction === true;
|
|
29
30
|
this.notification = notification;
|
|
30
31
|
}
|
|
31
32
|
}
|
package/package.json
CHANGED