@chevre/domain 21.4.0-alpha.1 → 21.4.0-alpha.11
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/cleanActions.ts +23 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +6 -0
- package/example/src/chevre/migrateEventOrganizer.ts +113 -0
- package/example/src/chevre/searchEvents.ts +1 -9
- package/example/src/chevre/searchProductOffers.ts +6 -0
- package/lib/chevre/repo/action.d.ts +6 -0
- package/lib/chevre/repo/action.js +13 -0
- package/lib/chevre/repo/event.d.ts +9 -4
- package/lib/chevre/repo/event.js +101 -60
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +7 -4
- package/lib/chevre/repo/mongoose/schemas/event.js +15 -2
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -6
- package/lib/chevre/repo/mongoose/schemas/place.js +9 -2
- package/lib/chevre/repo/place.d.ts +4 -4
- package/lib/chevre/repo/place.js +47 -27
- package/lib/chevre/repo/productOffer.d.ts +45 -5
- package/lib/chevre/repo/productOffer.js +113 -14
- package/lib/chevre/repo/seller.d.ts +4 -3
- package/lib/chevre/repo/seller.js +40 -38
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
- package/lib/chevre/service/assetTransaction/pay.js +9 -1
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +4 -3
- package/lib/chevre/service/assetTransaction/reserve/factory.js +6 -2
- package/lib/chevre/service/event.js +23 -25
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +15 -1
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard.js +9 -1
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +2 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
- package/lib/chevre/service/payment/movieTicket.js +19 -2
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
- package/lib/chevre/service/transaction/returnOrder.js +9 -3
- package/package.json +3 -3
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +0 -90
- package/example/src/chevre/migrateEventOffersItemOfferedTypeOf.ts +0 -75
- package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +0 -64
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +0 -79
|
@@ -28,7 +28,15 @@ const CodeService = require("../code");
|
|
|
28
28
|
*/
|
|
29
29
|
function start(params) {
|
|
30
30
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const
|
|
31
|
+
const sellers = yield repos.seller.search({
|
|
32
|
+
limit: 1,
|
|
33
|
+
page: 1,
|
|
34
|
+
id: { $eq: params.seller.id }
|
|
35
|
+
}, ['name', 'typeOf'], []);
|
|
36
|
+
const seller = sellers.shift();
|
|
37
|
+
if (seller === undefined) {
|
|
38
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
39
|
+
}
|
|
32
40
|
const passport = yield (0, validation_1.validateWaiterPassport)(params);
|
|
33
41
|
// 金額をfix
|
|
34
42
|
const amount = params.object.amount;
|
|
@@ -29,12 +29,15 @@ exports.POINT_AWARD_IDENTIFIER_NAME = 'pointAwardIdentifiers';
|
|
|
29
29
|
function start(params) {
|
|
30
30
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
var _a;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
32
|
+
const sellers = yield repos.seller.search({
|
|
33
|
+
limit: 1,
|
|
34
|
+
page: 1,
|
|
35
|
+
id: { $eq: params.seller.id }
|
|
36
|
+
}, ['name', 'project', 'typeOf', 'makesOffer'], []);
|
|
37
|
+
const seller = sellers.shift();
|
|
38
|
+
if (seller === undefined) {
|
|
39
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
40
|
+
}
|
|
38
41
|
let makesOfferFromClient;
|
|
39
42
|
// 販売者オファー検証(2022-10-14~)
|
|
40
43
|
if (params.validateSeller === true) {
|
|
@@ -29,9 +29,15 @@ function start(params) {
|
|
|
29
29
|
const now = new Date();
|
|
30
30
|
const { acceptedOffers, eventIds, offerIds, orders } = yield fixOrders(params)(repos);
|
|
31
31
|
// sellerはorderから自動取得
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const sellers = yield repos.seller.search({
|
|
33
|
+
limit: 1,
|
|
34
|
+
page: 1,
|
|
35
|
+
id: { $eq: String(orders[0].seller.id) }
|
|
36
|
+
}, ['name', 'project', 'hasMerchantReturnPolicy', 'typeOf'], []);
|
|
37
|
+
const seller = sellers.shift();
|
|
38
|
+
if (seller === undefined) {
|
|
39
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
40
|
+
}
|
|
35
41
|
yield validateOrder({ orders })(repos);
|
|
36
42
|
let offers = [];
|
|
37
43
|
if (offerIds.length > 0) {
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.315.0-alpha.3",
|
|
13
|
+
"@cinerino/sdk": "3.160.0-alpha.3",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.4.0-alpha.
|
|
120
|
+
"version": "21.4.0-alpha.11"
|
|
121
121
|
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
|
|
9
|
-
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
10
|
-
|
|
11
|
-
// tslint:disable-next-line:max-func-body-length
|
|
12
|
-
async function main() {
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
14
|
-
|
|
15
|
-
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
16
|
-
|
|
17
|
-
const cursor = eventRepo.getCursor(
|
|
18
|
-
{
|
|
19
|
-
// 'project.id': { $eq: project.id },
|
|
20
|
-
'project.id': { $ne: EXCLUDED_PROJECT_ID },
|
|
21
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
22
|
-
startDate: {
|
|
23
|
-
$gte: moment()
|
|
24
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
25
|
-
.add(-6, 'months')
|
|
26
|
-
.toDate()
|
|
27
|
-
}
|
|
28
|
-
// _id: { $eq: 'al6aff83w' }
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
// _id: 1,
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
console.log('events found');
|
|
35
|
-
|
|
36
|
-
let i = 0;
|
|
37
|
-
let updateCount = 0;
|
|
38
|
-
await cursor.eachAsync(async (doc) => {
|
|
39
|
-
i += 1;
|
|
40
|
-
const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
|
|
41
|
-
|
|
42
|
-
const eventOffers = <chevre.factory.event.screeningEvent.IOffer | undefined>event.offers;
|
|
43
|
-
if (eventOffers === undefined) {
|
|
44
|
-
throw new Error('event.offers undefined');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const availableChannel = eventOffers.itemOffered.availableChannel;
|
|
48
|
-
|
|
49
|
-
const alreadyMigrated = availableChannel?.typeOf === 'ServiceChannel';
|
|
50
|
-
|
|
51
|
-
if (alreadyMigrated) {
|
|
52
|
-
console.log(
|
|
53
|
-
'already exist...', event.project.id, event.id, event.startDate, availableChannel.serviceLocation.branchCode, i);
|
|
54
|
-
} else {
|
|
55
|
-
const newAvailableChannel: chevre.factory.reservation.IServiceChannel = {
|
|
56
|
-
typeOf: 'ServiceChannel',
|
|
57
|
-
serviceLocation: {
|
|
58
|
-
typeOf: event.location.typeOf,
|
|
59
|
-
branchCode: event.location.branchCode,
|
|
60
|
-
name: event.location.name,
|
|
61
|
-
containedInPlace: {
|
|
62
|
-
typeOf: event.superEvent.location.typeOf,
|
|
63
|
-
id: event.superEvent.location.id,
|
|
64
|
-
branchCode: event.superEvent.location.branchCode,
|
|
65
|
-
name: event.superEvent.location.name
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
console.log(
|
|
70
|
-
'updating seller...', event.project.id, event.id, event.startDate, newAvailableChannel.serviceLocation.branchCode, i);
|
|
71
|
-
await eventRepo.updatePartiallyById({
|
|
72
|
-
id: event.id,
|
|
73
|
-
attributes: <any>{
|
|
74
|
-
typeOf: event.typeOf,
|
|
75
|
-
'offers.itemOffered.availableChannel': newAvailableChannel
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
updateCount += 1;
|
|
79
|
-
console.log(
|
|
80
|
-
'updated...', event.project.id, event.id, event.startDate, i);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
console.log(i, 'events checked');
|
|
85
|
-
console.log(updateCount, 'events updated');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
main()
|
|
89
|
-
.then()
|
|
90
|
-
.catch(console.error);
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
13
|
-
|
|
14
|
-
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = eventRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
// 'project.id': { $eq: project.id },
|
|
19
|
-
'project.id': { $ne: EXCLUDED_PROJECT_ID },
|
|
20
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
21
|
-
startDate: {
|
|
22
|
-
$gte: moment()
|
|
23
|
-
.add(-1, 'month')
|
|
24
|
-
.toDate()
|
|
25
|
-
}
|
|
26
|
-
// _id: { $eq: 'al6aff83w' }
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
// _id: 1,
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
console.log('events found');
|
|
33
|
-
|
|
34
|
-
let i = 0;
|
|
35
|
-
let updateCount = 0;
|
|
36
|
-
await cursor.eachAsync(async (doc) => {
|
|
37
|
-
i += 1;
|
|
38
|
-
const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
|
|
39
|
-
|
|
40
|
-
// IAMメンバー検索
|
|
41
|
-
const eventOffers = <chevre.factory.event.screeningEvent.IOffer | undefined>event.offers;
|
|
42
|
-
if (eventOffers === undefined) {
|
|
43
|
-
throw new Error('event.offers undefined');
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const itemOfferedTypeOf = eventOffers.itemOffered.typeOf;
|
|
47
|
-
|
|
48
|
-
const alreadyMigrated = itemOfferedTypeOf === chevre.factory.product.ProductType.EventService;
|
|
49
|
-
|
|
50
|
-
if (alreadyMigrated) {
|
|
51
|
-
console.log(
|
|
52
|
-
'already exist...', event.project.id, event.id, event.startDate, itemOfferedTypeOf, i);
|
|
53
|
-
} else {
|
|
54
|
-
console.log(
|
|
55
|
-
'updating seller...', event.project.id, event.id, event.startDate, i);
|
|
56
|
-
await eventRepo.updatePartiallyById({
|
|
57
|
-
id: event.id,
|
|
58
|
-
attributes: <any>{
|
|
59
|
-
typeOf: event.typeOf,
|
|
60
|
-
'offers.itemOffered.typeOf': chevre.factory.product.ProductType.EventService
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
updateCount += 1;
|
|
64
|
-
console.log(
|
|
65
|
-
'updated...', event.project.id, event.id, event.startDate, i);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
console.log(i, 'events checked');
|
|
70
|
-
console.log(updateCount, 'events updated');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
main()
|
|
74
|
-
.then()
|
|
75
|
-
.catch(console.error);
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
const DELETING_PROPERTY_NAME: string = 'COA_ENDPOINT';
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
-
|
|
12
|
-
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const cursor = eventRepo.getCursor(
|
|
15
|
-
{
|
|
16
|
-
'project.id': { $eq: project.id },
|
|
17
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries }
|
|
18
|
-
// typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
19
|
-
// startDate: { $gte: new Date() }
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
// _id: 1,
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
console.log('events found');
|
|
26
|
-
|
|
27
|
-
let i = 0;
|
|
28
|
-
let updateCount = 0;
|
|
29
|
-
await cursor.eachAsync(async (doc) => {
|
|
30
|
-
i += 1;
|
|
31
|
-
const event: chevre.factory.event.IEvent<chevre.factory.eventType> = doc.toObject();
|
|
32
|
-
|
|
33
|
-
const coaEndpointPropert = event.additionalProperty?.find((p) => p.name === DELETING_PROPERTY_NAME);
|
|
34
|
-
|
|
35
|
-
if (coaEndpointPropert !== undefined) {
|
|
36
|
-
const newAdditionalProperty: chevre.factory.propertyValue.IPropertyValue<string>[] =
|
|
37
|
-
(Array.isArray(event.additionalProperty))
|
|
38
|
-
? event.additionalProperty.filter((p) => {
|
|
39
|
-
return p.name !== DELETING_PROPERTY_NAME;
|
|
40
|
-
})
|
|
41
|
-
: [];
|
|
42
|
-
console.log(
|
|
43
|
-
'updating event...', event.project.id, event.id, event.startDate, coaEndpointPropert.value, newAdditionalProperty, i);
|
|
44
|
-
await eventRepo.updatePartiallyById({
|
|
45
|
-
id: event.id,
|
|
46
|
-
attributes: <any>{
|
|
47
|
-
typeOf: event.typeOf,
|
|
48
|
-
additionalProperty: newAdditionalProperty
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
updateCount += 1;
|
|
52
|
-
console.log('event updated', event.project.id, event.id, event.startDate, i);
|
|
53
|
-
} else {
|
|
54
|
-
console.log('no property...', event.project.id, event.id, event.startDate, i);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
console.log(i, 'events checked');
|
|
59
|
-
console.log(updateCount, 'events updated');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
main()
|
|
63
|
-
.then()
|
|
64
|
-
.catch(console.error);
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
// import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// const project = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
|
|
8
|
-
|
|
9
|
-
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
10
|
-
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = eventRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
'project.id': {
|
|
19
|
-
// $eq: project.id,
|
|
20
|
-
$ne: EXCLUDED_PROJECT_ID
|
|
21
|
-
},
|
|
22
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries },
|
|
23
|
-
'workPerformed.version': { $exists: false }
|
|
24
|
-
// _id: { $eq: 'bl7ed6sq9' }
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
_id: 1,
|
|
28
|
-
workPerformed: 1,
|
|
29
|
-
project: 1,
|
|
30
|
-
location: 1,
|
|
31
|
-
startDate: 1,
|
|
32
|
-
typeOf: 1
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
console.log('events found');
|
|
36
|
-
|
|
37
|
-
let i = 0;
|
|
38
|
-
let updateCount = 0;
|
|
39
|
-
await cursor.eachAsync(async (doc) => {
|
|
40
|
-
i += 1;
|
|
41
|
-
const event: chevre.factory.event.screeningEventSeries.IEvent = doc.toObject();
|
|
42
|
-
const version = event.workPerformed.version;
|
|
43
|
-
|
|
44
|
-
const alreadyMigrated = typeof version === 'string' && version.length > 0;
|
|
45
|
-
|
|
46
|
-
if (alreadyMigrated) {
|
|
47
|
-
console.log('alreadyMigrated.', event.project.id, event.id, event.startDate, version, i);
|
|
48
|
-
} else {
|
|
49
|
-
// 既存施設コンテンツバージョンを検索
|
|
50
|
-
const { maxVersion } = await eventRepo.aggregateScreeningEventMaxVersion({
|
|
51
|
-
project: { id: { $eq: event.project.id } },
|
|
52
|
-
workPerformed: { identifier: { $eq: event.workPerformed.identifier } },
|
|
53
|
-
location: { branchCode: { $in: [event.location.branchCode] } }
|
|
54
|
-
});
|
|
55
|
-
console.log('maxVersion:', maxVersion);
|
|
56
|
-
|
|
57
|
-
const newVersion: string = `${Number(maxVersion) + 1}`;
|
|
58
|
-
console.log('updating event...', event.project.id, event.id, event.startDate, newVersion, i);
|
|
59
|
-
await eventRepo.updatePartiallyById({
|
|
60
|
-
id: event.id,
|
|
61
|
-
attributes: <any>{
|
|
62
|
-
typeOf: event.typeOf,
|
|
63
|
-
'workPerformed.version': newVersion
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
updateCount += 1;
|
|
67
|
-
console.log('updated.', event.project.id, event.id, event.startDate, newVersion, i);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
console.log(i, 'events checked');
|
|
72
|
-
console.log(updateCount, 'events updated');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
main()
|
|
76
|
-
.then(() => {
|
|
77
|
-
console.log('success!');
|
|
78
|
-
})
|
|
79
|
-
.catch(console.error);
|