@chevre/domain 22.6.0-alpha.21 → 22.6.0-alpha.22
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/unsetUnnecessaryFields.ts +34 -16
- package/lib/chevre/repo/offerCatalog.d.ts +5 -1
- package/lib/chevre/repo/offerCatalog.js +6 -0
- package/lib/chevre/repo/offerCatalogItem.d.ts +5 -1
- package/lib/chevre/repo/offerCatalogItem.js +6 -0
- package/lib/chevre/service/reserve/checkInReservation.js +6 -6
- package/lib/chevre/settings.d.ts +0 -2
- package/lib/chevre/settings.js +1 -2
- package/package.json +1 -1
|
@@ -1,33 +1,51 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
2
|
+
// import * as moment from 'moment';
|
|
3
3
|
import * as mongoose from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { chevre } from '../../../lib/index';
|
|
6
6
|
|
|
7
|
-
const excludedProject = { id: String(process.env.EXCLUDED_PROJECT_ID) };
|
|
7
|
+
// const excludedProject = { id: String(process.env.EXCLUDED_PROJECT_ID) };
|
|
8
8
|
|
|
9
9
|
async function main() {
|
|
10
10
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const aggregateOfferRepo = await chevre.repository.AggregateOffer.createInstance(mongoose.connection);
|
|
13
|
+
const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
|
|
14
|
+
const offerCatalogItemRepo = await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
|
|
13
15
|
|
|
14
16
|
let updateResult: any;
|
|
15
|
-
updateResult = await
|
|
17
|
+
updateResult = await aggregateOfferRepo.unsetUnnecessaryFields({
|
|
16
18
|
filter: {
|
|
17
|
-
|
|
18
|
-
'offers.validFrom': { $exists: true },
|
|
19
|
-
startDate: {
|
|
20
|
-
$gte: moment()
|
|
21
|
-
.add(-1, 'days')
|
|
22
|
-
.toDate()
|
|
23
|
-
}
|
|
24
|
-
// _id: { $eq: 'blxd1grz3' }
|
|
19
|
+
_id: { $exists: true }
|
|
25
20
|
},
|
|
26
21
|
$unset: <any>{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
createdAt: 1,
|
|
23
|
+
updatedAt: 1,
|
|
24
|
+
__v: 1
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
console.log(updateResult);
|
|
28
|
+
|
|
29
|
+
updateResult = await offerCatalogRepo.unsetUnnecessaryFields({
|
|
30
|
+
filter: {
|
|
31
|
+
_id: { $exists: true }
|
|
32
|
+
},
|
|
33
|
+
$unset: <any>{
|
|
34
|
+
createdAt: 1,
|
|
35
|
+
updatedAt: 1,
|
|
36
|
+
__v: 1
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
console.log(updateResult);
|
|
40
|
+
|
|
41
|
+
updateResult = await offerCatalogItemRepo.unsetUnnecessaryFields({
|
|
42
|
+
filter: {
|
|
43
|
+
_id: { $exists: true }
|
|
44
|
+
},
|
|
45
|
+
$unset: <any>{
|
|
46
|
+
createdAt: 1,
|
|
47
|
+
updatedAt: 1,
|
|
48
|
+
__v: 1
|
|
31
49
|
}
|
|
32
50
|
});
|
|
33
51
|
console.log(updateResult);
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import type { BulkWriteResult } from 'mongodb';
|
|
26
|
-
import type { Connection, Document } from 'mongoose';
|
|
26
|
+
import type { Connection, Document, FilterQuery } from 'mongoose';
|
|
27
27
|
import * as factory from '../factory';
|
|
28
28
|
import { IDocType } from './mongoose/schemas/offerCatalog';
|
|
29
29
|
export type IAggregatedOfferCatalog = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered' | 'additionalProperty'> & {
|
|
@@ -170,5 +170,9 @@ export declare class OfferCatalogRepo {
|
|
|
170
170
|
} & Required<{
|
|
171
171
|
_id: string;
|
|
172
172
|
}>>>;
|
|
173
|
+
unsetUnnecessaryFields(params: {
|
|
174
|
+
filter: FilterQuery<factory.offerCatalog.IOfferCatalog>;
|
|
175
|
+
$unset: any;
|
|
176
|
+
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
173
177
|
}
|
|
174
178
|
export {};
|
|
@@ -471,5 +471,11 @@ class OfferCatalogRepo {
|
|
|
471
471
|
.sort({ identifier: factory.sortType.Descending })
|
|
472
472
|
.cursor();
|
|
473
473
|
}
|
|
474
|
+
unsetUnnecessaryFields(params) {
|
|
475
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
476
|
+
return this.offerCatalogModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
477
|
+
.exec();
|
|
478
|
+
});
|
|
479
|
+
}
|
|
474
480
|
}
|
|
475
481
|
exports.OfferCatalogRepo = OfferCatalogRepo;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import type { BulkWriteResult } from 'mongodb';
|
|
26
|
-
import { Connection } from 'mongoose';
|
|
26
|
+
import { Connection, FilterQuery } from 'mongoose';
|
|
27
27
|
import * as factory from '../factory';
|
|
28
28
|
export type IAggregatedOfferCatalog = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered' | 'additionalProperty' | 'relatedOffer'> & {
|
|
29
29
|
numberOfItems?: number;
|
|
@@ -118,5 +118,9 @@ export declare class OfferCatalogItemRepo {
|
|
|
118
118
|
};
|
|
119
119
|
};
|
|
120
120
|
}): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
|
|
121
|
+
unsetUnnecessaryFields(params: {
|
|
122
|
+
filter: FilterQuery<factory.offerCatalog.IOfferCatalog>;
|
|
123
|
+
$unset: any;
|
|
124
|
+
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
121
125
|
}
|
|
122
126
|
export {};
|
|
@@ -392,5 +392,11 @@ class OfferCatalogItemRepo {
|
|
|
392
392
|
.exec();
|
|
393
393
|
});
|
|
394
394
|
}
|
|
395
|
+
unsetUnnecessaryFields(params) {
|
|
396
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
397
|
+
return this.offerCatalogItemModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
398
|
+
.exec();
|
|
399
|
+
});
|
|
400
|
+
}
|
|
395
401
|
}
|
|
396
402
|
exports.OfferCatalogItemRepo = OfferCatalogItemRepo;
|
|
@@ -45,12 +45,12 @@ function checkInReservation(params) {
|
|
|
45
45
|
}
|
|
46
46
|
yield repos.reservation.checkInIfNot({ reservationNumber: { $in: params.object.reservationNumbers }, now });
|
|
47
47
|
// support useNotificationCheckedInAsPackage(2024-11-06~)
|
|
48
|
-
if (!settings.useNotificationCheckedInAsPackage) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
48
|
+
// if (!settings.useNotificationCheckedInAsPackage) {
|
|
49
|
+
// // 予約番号リストを予約IDリストに変換
|
|
50
|
+
// checkedInReservationIds = await repos.reservation.searchIdsByReservationNumber({
|
|
51
|
+
// reservationNumber: { $in: params.object.reservationNumbers }
|
|
52
|
+
// });
|
|
53
|
+
// }
|
|
54
54
|
}
|
|
55
55
|
if (Array.isArray(checkedInReservationIds)) {
|
|
56
56
|
yield (0, onReservationCheckedIn_1.onReservationCheckedIn)({
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -81,7 +81,6 @@ interface IOptions {
|
|
|
81
81
|
};
|
|
82
82
|
useAssetTransactionSyncProcessing: boolean;
|
|
83
83
|
useExperimentalFeature: boolean;
|
|
84
|
-
useNotificationCheckedInAsPackage?: boolean;
|
|
85
84
|
useNotificationUseAction?: boolean;
|
|
86
85
|
notification: IWebhookSettings;
|
|
87
86
|
}
|
|
@@ -141,7 +140,6 @@ declare class Settings {
|
|
|
141
140
|
};
|
|
142
141
|
readonly useAssetTransactionSyncProcessing: boolean;
|
|
143
142
|
readonly useExperimentalFeature: boolean;
|
|
144
|
-
readonly useNotificationCheckedInAsPackage: boolean;
|
|
145
143
|
readonly useNotificationUseAction: boolean;
|
|
146
144
|
/**
|
|
147
145
|
* 通知設定
|
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,
|
|
11
|
+
const { onEventChanged, onOrderStatusChanged, onResourceUpdated, onReservationStatusChanged, userPoolIdOld, userPoolIdNew, abortedTasksWithoutReport, numTryConfirmReserveTransaction, transaction, defaultSenderEmail, deliverOrderLimit, coa, gmo, movieticketReserve, useAssetTransactionSyncProcessing, useExperimentalFeature, useNotificationUseAction, notification } = options;
|
|
12
12
|
this.onEventChanged = onEventChanged;
|
|
13
13
|
this.onOrderStatusChanged = onOrderStatusChanged;
|
|
14
14
|
this.onResourceUpdated = onResourceUpdated;
|
|
@@ -25,7 +25,6 @@ class Settings {
|
|
|
25
25
|
this.movieticketReserve = movieticketReserve;
|
|
26
26
|
this.useAssetTransactionSyncProcessing = useAssetTransactionSyncProcessing;
|
|
27
27
|
this.useExperimentalFeature = useExperimentalFeature;
|
|
28
|
-
this.useNotificationCheckedInAsPackage = useNotificationCheckedInAsPackage === true;
|
|
29
28
|
this.useNotificationUseAction = useNotificationUseAction === true;
|
|
30
29
|
this.notification = notification;
|
|
31
30
|
}
|
package/package.json
CHANGED