@chevre/domain 22.6.0-alpha.21 → 22.6.0-alpha.23
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/event.d.ts +0 -5
- package/lib/chevre/repo/event.js +0 -26
- 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/repo/place/movieTheater.d.ts +0 -6
- package/lib/chevre/repo/place/movieTheater.js +0 -14
- 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);
|
|
@@ -294,11 +294,6 @@ export declare class EventRepo {
|
|
|
294
294
|
};
|
|
295
295
|
};
|
|
296
296
|
}): Promise<import("mongodb").DeleteResult>;
|
|
297
|
-
/**
|
|
298
|
-
* 旧施設コンテンツ廃止専用メソッド
|
|
299
|
-
* 2024-09-11~
|
|
300
|
-
*/
|
|
301
|
-
deleteOldEventSeries(): Promise<import("mongodb").DeleteResult>;
|
|
302
297
|
deleteManyEventsEndedByProject(params: {
|
|
303
298
|
typeOf: {
|
|
304
299
|
$in: AvailableEventType[];
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -934,32 +934,6 @@ class EventRepo {
|
|
|
934
934
|
.exec();
|
|
935
935
|
});
|
|
936
936
|
}
|
|
937
|
-
/**
|
|
938
|
-
* 旧施設コンテンツ廃止専用メソッド
|
|
939
|
-
* 2024-09-11~
|
|
940
|
-
*/
|
|
941
|
-
deleteOldEventSeries() {
|
|
942
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
943
|
-
return this.eventModel.deleteMany({
|
|
944
|
-
typeOf: { $eq: factory.eventType.ScreeningEventSeries }
|
|
945
|
-
})
|
|
946
|
-
.exec();
|
|
947
|
-
});
|
|
948
|
-
}
|
|
949
|
-
// public async deleteManyEndedByIds(params: {
|
|
950
|
-
// typeOf: { $in: factory.eventType[] };
|
|
951
|
-
// project: { id: string };
|
|
952
|
-
// ids: string[];
|
|
953
|
-
// endDate: { $lte: Date };
|
|
954
|
-
// }) {
|
|
955
|
-
// return this.eventModel.deleteMany({
|
|
956
|
-
// typeOf: { $in: params.typeOf.$in },
|
|
957
|
-
// 'project.id': { $eq: params.project.id },
|
|
958
|
-
// _id: { $in: params.ids },
|
|
959
|
-
// endDate: { $lte: params.endDate.$lte }
|
|
960
|
-
// })
|
|
961
|
-
// .exec();
|
|
962
|
-
// }
|
|
963
937
|
deleteManyEventsEndedByProject(params) {
|
|
964
938
|
return __awaiter(this, void 0, void 0, function* () {
|
|
965
939
|
return this.eventModel.deleteMany({
|
|
@@ -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;
|
|
@@ -35,7 +35,6 @@ type IKeyOfProjection = keyof factory.place.movieTheater.IPlace;
|
|
|
35
35
|
*/
|
|
36
36
|
export declare class MovieTheaterRepo {
|
|
37
37
|
private readonly civicStructureModel;
|
|
38
|
-
private readonly placeModel;
|
|
39
38
|
constructor(connection: Connection);
|
|
40
39
|
static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params: factory.place.movieTheater.ISearchConditions): FilterQuery<import("@chevre/factory/lib/place/movieTheater").IPlace>[];
|
|
41
40
|
/**
|
|
@@ -96,10 +95,5 @@ export declare class MovieTheaterRepo {
|
|
|
96
95
|
filter: any;
|
|
97
96
|
$unset: any;
|
|
98
97
|
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
99
|
-
/**
|
|
100
|
-
* 旧施設廃止専用メソッド
|
|
101
|
-
* 2024-09-17~
|
|
102
|
-
*/
|
|
103
|
-
deleteOldMovieTheaters(): Promise<import("mongodb").DeleteResult>;
|
|
104
98
|
}
|
|
105
99
|
export {};
|
|
@@ -24,7 +24,6 @@ exports.MovieTheaterRepo = void 0;
|
|
|
24
24
|
const factory = require("../../factory");
|
|
25
25
|
const settings_1 = require("../../settings");
|
|
26
26
|
const civicStructure_1 = require("../mongoose/schemas/civicStructure");
|
|
27
|
-
const place_1 = require("../mongoose/schemas/place");
|
|
28
27
|
const AVAILABLE_PROJECT_FIELDS = [
|
|
29
28
|
'additionalProperty', 'branchCode', 'hasEntranceGate', 'kanaName', 'name',
|
|
30
29
|
'offers', 'parentOrganization', 'project', 'telephone', 'typeOf', 'url'
|
|
@@ -35,7 +34,6 @@ const AVAILABLE_PROJECT_FIELDS = [
|
|
|
35
34
|
class MovieTheaterRepo {
|
|
36
35
|
constructor(connection) {
|
|
37
36
|
this.civicStructureModel = connection.model(civicStructure_1.modelName, (0, civicStructure_1.createSchema)());
|
|
38
|
-
this.placeModel = connection.model(place_1.modelName, (0, place_1.createSchema)());
|
|
39
37
|
}
|
|
40
38
|
// tslint:disable-next-line:max-func-body-length
|
|
41
39
|
static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params) {
|
|
@@ -252,17 +250,5 @@ class MovieTheaterRepo {
|
|
|
252
250
|
.exec();
|
|
253
251
|
});
|
|
254
252
|
}
|
|
255
|
-
/**
|
|
256
|
-
* 旧施設廃止専用メソッド
|
|
257
|
-
* 2024-09-17~
|
|
258
|
-
*/
|
|
259
|
-
deleteOldMovieTheaters() {
|
|
260
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
261
|
-
return this.placeModel.deleteMany({
|
|
262
|
-
typeOf: { $eq: factory.placeType.MovieTheater }
|
|
263
|
-
})
|
|
264
|
-
.exec();
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
253
|
}
|
|
268
254
|
exports.MovieTheaterRepo = MovieTheaterRepo;
|
|
@@ -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