@chevre/domain 20.4.0-alpha.8 → 20.4.0-alpha.9
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/migrateMoneyTransferPendingTransactionIdentifier.ts +96 -0
- package/lib/chevre/repo/assetTransaction.d.ts +1 -0
- package/lib/chevre/repo/assetTransaction.js +5 -0
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +17 -8
- package/lib/chevre/service/delivery.js +12 -3
- package/lib/chevre/service/event.js +3 -23
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +0 -1
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +0 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
- package/lib/chevre/settings.d.ts +1 -0
- package/lib/chevre/settings.js +2 -2
- package/package.json +3 -3
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +0 -157
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
// tslint:disable-next-line:max-func-body-length
|
|
10
|
+
async function main() {
|
|
11
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
|
+
|
|
13
|
+
const accountTransactionRepo = new chevre.repository.AccountTransaction(mongoose.connection);
|
|
14
|
+
const assetTransactionRepo = new chevre.repository.AssetTransaction(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const cursor = assetTransactionRepo.getCursor(
|
|
17
|
+
{
|
|
18
|
+
'project.id': { $eq: project.id },
|
|
19
|
+
typeOf: { $eq: chevre.factory.assetTransactionType.MoneyTransfer },
|
|
20
|
+
startDate: {
|
|
21
|
+
$gte: moment('2023-02-17T15:00:00Z')
|
|
22
|
+
.toDate()
|
|
23
|
+
}
|
|
24
|
+
// _id: { $eq: 'al6aff83w' }
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
// _id: 1,
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
console.log('assetTransactions found');
|
|
31
|
+
|
|
32
|
+
let i = 0;
|
|
33
|
+
let updateCount = 0;
|
|
34
|
+
// tslint:disable-next-line:max-func-body-length
|
|
35
|
+
await cursor.eachAsync(async (doc) => {
|
|
36
|
+
i += 1;
|
|
37
|
+
const moneyTransferTransaction: chevre.factory.assetTransaction.moneyTransfer.ITransaction = doc.toObject();
|
|
38
|
+
|
|
39
|
+
const description = moneyTransferTransaction.object.description;
|
|
40
|
+
if (description !== '鑑賞' && description !== '受け取り') {
|
|
41
|
+
console.log(
|
|
42
|
+
'no operation needed',
|
|
43
|
+
description,
|
|
44
|
+
moneyTransferTransaction.project.id,
|
|
45
|
+
moneyTransferTransaction.transactionNumber,
|
|
46
|
+
moneyTransferTransaction.startDate
|
|
47
|
+
);
|
|
48
|
+
} else {
|
|
49
|
+
const pendingTransactionIdentifier = moneyTransferTransaction.object.pendingTransaction?.identifier;
|
|
50
|
+
if (typeof pendingTransactionIdentifier === 'string' && pendingTransactionIdentifier.length > 0) {
|
|
51
|
+
console.log(
|
|
52
|
+
'pendingTransactionIdentifier found',
|
|
53
|
+
description,
|
|
54
|
+
moneyTransferTransaction.project.id,
|
|
55
|
+
moneyTransferTransaction.transactionNumber,
|
|
56
|
+
moneyTransferTransaction.startDate
|
|
57
|
+
);
|
|
58
|
+
} else {
|
|
59
|
+
// 口座取引からidentifierを取得
|
|
60
|
+
const accountTransaction =
|
|
61
|
+
await accountTransactionRepo.findByTransactionNumber({ transactionNumber: moneyTransferTransaction.transactionNumber });
|
|
62
|
+
console.log(
|
|
63
|
+
'updating identifier...',
|
|
64
|
+
accountTransaction.identifier,
|
|
65
|
+
description,
|
|
66
|
+
moneyTransferTransaction.project.id,
|
|
67
|
+
moneyTransferTransaction.transactionNumber,
|
|
68
|
+
moneyTransferTransaction.startDate
|
|
69
|
+
);
|
|
70
|
+
if (typeof accountTransaction.identifier === 'string') {
|
|
71
|
+
await assetTransactionRepo.findByIdAndUpdate({
|
|
72
|
+
id: moneyTransferTransaction.id,
|
|
73
|
+
update: {
|
|
74
|
+
'object.pendingTransaction.identifier': accountTransaction.identifier
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
console.log(
|
|
79
|
+
'ientifier updated',
|
|
80
|
+
accountTransaction.identifier,
|
|
81
|
+
description,
|
|
82
|
+
moneyTransferTransaction.project.id,
|
|
83
|
+
moneyTransferTransaction.transactionNumber,
|
|
84
|
+
moneyTransferTransaction.startDate
|
|
85
|
+
);
|
|
86
|
+
updateCount += 1;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
console.log(i, 'assetTransactions checked');
|
|
91
|
+
console.log(updateCount, 'assetTransactions updated');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
main()
|
|
95
|
+
.then()
|
|
96
|
+
.catch(console.error);
|
|
@@ -144,6 +144,7 @@ export declare class MongoRepository {
|
|
|
144
144
|
findByIdAndDelete(params: {
|
|
145
145
|
id: string;
|
|
146
146
|
}): Promise<void>;
|
|
147
|
+
getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
|
|
147
148
|
aggregateAssetTransaction(params: {
|
|
148
149
|
project?: {
|
|
149
150
|
id?: {
|
|
@@ -536,6 +536,11 @@ class MongoRepository {
|
|
|
536
536
|
.exec();
|
|
537
537
|
});
|
|
538
538
|
}
|
|
539
|
+
getCursor(conditions, projection) {
|
|
540
|
+
return this.transactionModel.find(conditions, projection)
|
|
541
|
+
.sort({ startDate: factory.sortType.Ascending })
|
|
542
|
+
.cursor();
|
|
543
|
+
}
|
|
539
544
|
aggregateAssetTransaction(params) {
|
|
540
545
|
return __awaiter(this, void 0, void 0, function* () {
|
|
541
546
|
const statuses = yield Promise.all([
|
|
@@ -62,20 +62,29 @@ function start(params) {
|
|
|
62
62
|
recipient: params.recipient,
|
|
63
63
|
object: Object.assign(Object.assign({ amount,
|
|
64
64
|
fromLocation,
|
|
65
|
-
toLocation, pendingTransaction: Object.assign({ typeOf: transactionType,
|
|
65
|
+
toLocation, pendingTransaction: Object.assign({ typeOf: transactionType, transactionNumber: transactionNumber }, (typeof params.identifier === 'string') ? { identifier: params.identifier } : undefined) }, (typeof params.object.description === 'string') ? { description: params.object.description } : {}), { force: params.object.force === true }),
|
|
66
66
|
expires: params.expires
|
|
67
67
|
};
|
|
68
68
|
// 取引開始
|
|
69
69
|
let transaction;
|
|
70
70
|
try {
|
|
71
71
|
transaction = yield repos.assetTransaction.start(startParams);
|
|
72
|
-
const pendingTransaction =
|
|
73
|
-
yield
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
// const pendingTransaction = await authorizeAccount({ transaction })(repos);
|
|
73
|
+
yield authorizeAccount({ transaction })(repos);
|
|
74
|
+
// 更新不要(2023-02-20~)
|
|
75
|
+
// await repos.assetTransaction.findByIdAndUpdate<factory.assetTransactionType.MoneyTransfer>({
|
|
76
|
+
// id: transaction.id,
|
|
77
|
+
// update: {
|
|
78
|
+
// 'object.pendingTransaction': {
|
|
79
|
+
// typeOf: pendingTransaction.typeOf,
|
|
80
|
+
// id: pendingTransaction.id,
|
|
81
|
+
// transactionNumber: pendingTransaction.transactionNumber,
|
|
82
|
+
// ...(typeof pendingTransaction.identifier === 'string')
|
|
83
|
+
// ? { identifier: pendingTransaction.identifier }
|
|
84
|
+
// : undefined
|
|
85
|
+
// }
|
|
86
|
+
// }
|
|
87
|
+
// });
|
|
79
88
|
}
|
|
80
89
|
catch (error) {
|
|
81
90
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -88,7 +88,10 @@ function createGivePointAwardStartParams4moneyTransfer(params, transactionNumber
|
|
|
88
88
|
: params.purpose.typeOf,
|
|
89
89
|
fromLocation: agent,
|
|
90
90
|
toLocation,
|
|
91
|
-
pendingTransaction: {
|
|
91
|
+
pendingTransaction: {
|
|
92
|
+
typeOf: factory.account.transactionType.Deposit,
|
|
93
|
+
transactionNumber
|
|
94
|
+
}
|
|
92
95
|
} }, (typeof params.object.identifier === 'string') ? { identifier: params.object.identifier } : undefined);
|
|
93
96
|
}
|
|
94
97
|
/**
|
|
@@ -181,7 +184,10 @@ function processReturnPointAwardByTransactionIdentifier(params) {
|
|
|
181
184
|
fromLocation,
|
|
182
185
|
toLocation: depositTransaction.object.fromLocation,
|
|
183
186
|
description: `[Return Award]${depositTransaction.object.description}`,
|
|
184
|
-
pendingTransaction: {
|
|
187
|
+
pendingTransaction: {
|
|
188
|
+
typeOf: factory.account.transactionType.Withdraw,
|
|
189
|
+
transactionNumber
|
|
190
|
+
},
|
|
185
191
|
force: true
|
|
186
192
|
}
|
|
187
193
|
})(repos);
|
|
@@ -260,7 +266,10 @@ function processReturnPointAwardByTransactionFromLocationIdentifier(params) {
|
|
|
260
266
|
// },
|
|
261
267
|
toLocation,
|
|
262
268
|
description: `[Return Award]${returningTransaction.object.description}`,
|
|
263
|
-
pendingTransaction: {
|
|
269
|
+
pendingTransaction: {
|
|
270
|
+
typeOf: factory.account.transactionType.Transfer,
|
|
271
|
+
transactionNumber
|
|
272
|
+
},
|
|
264
273
|
force: true
|
|
265
274
|
}
|
|
266
275
|
})(repos);
|
|
@@ -21,6 +21,7 @@ const difference = require("lodash.difference");
|
|
|
21
21
|
const moment = require("moment-timezone");
|
|
22
22
|
const credentials_1 = require("../credentials");
|
|
23
23
|
const factory = require("../factory");
|
|
24
|
+
const settings_1 = require("../settings");
|
|
24
25
|
const offer_1 = require("./offer");
|
|
25
26
|
// const customsearch = google.customsearch('v1');
|
|
26
27
|
const debug = createDebug('chevre-domain:service:event');
|
|
@@ -449,32 +450,11 @@ function createScreeningEventFromCOA(params) {
|
|
|
449
450
|
priceCurrency: factory.priceCurrency.JPY
|
|
450
451
|
};
|
|
451
452
|
const { additionalProperty, coaInfo } = createScreeningEventAdditionalPropertyFromCOA(params);
|
|
452
|
-
return {
|
|
453
|
-
project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
454
|
-
typeOf: factory.eventType.ScreeningEvent,
|
|
455
|
-
id: id,
|
|
456
|
-
identifier: id,
|
|
457
|
-
name: params.superEvent.name,
|
|
458
|
-
eventStatus: factory.eventStatusType.EventScheduled,
|
|
459
|
-
workPerformed: params.superEvent.workPerformed,
|
|
460
|
-
location: {
|
|
461
|
-
// 不要なので廃止(2022-12-19~)
|
|
462
|
-
// project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
453
|
+
return Object.assign({ project: { typeOf: params.project.typeOf, id: params.project.id }, typeOf: factory.eventType.ScreeningEvent, id: id, identifier: id, name: params.superEvent.name, eventStatus: factory.eventStatusType.EventScheduled, location: {
|
|
463
454
|
typeOf: params.screenRoom.typeOf,
|
|
464
455
|
branchCode: params.screenRoom.branchCode,
|
|
465
456
|
name: params.screenRoom.name
|
|
466
|
-
},
|
|
467
|
-
endDate: endDate,
|
|
468
|
-
startDate: startDate,
|
|
469
|
-
superEvent: params.superEvent,
|
|
470
|
-
coaInfo,
|
|
471
|
-
offers: offers,
|
|
472
|
-
checkInCount: 0,
|
|
473
|
-
attendeeCount: 0,
|
|
474
|
-
maximumAttendeeCapacity: params.screenRoom.maximumAttendeeCapacity,
|
|
475
|
-
remainingAttendeeCapacity: params.screenRoom.maximumAttendeeCapacity,
|
|
476
|
-
additionalProperty
|
|
477
|
-
};
|
|
457
|
+
}, endDate: endDate, startDate: startDate, superEvent: params.superEvent, coaInfo, offers: offers, checkInCount: 0, attendeeCount: 0, maximumAttendeeCapacity: params.screenRoom.maximumAttendeeCapacity, remainingAttendeeCapacity: params.screenRoom.maximumAttendeeCapacity, additionalProperty }, (settings_1.settings.useEventWorkPerformed) ? { workPerformed: params.superEvent.workPerformed } : undefined);
|
|
478
458
|
}
|
|
479
459
|
function createScreeningEventAdditionalPropertyFromCOA(params) {
|
|
480
460
|
const coaInfo = {
|
|
@@ -57,7 +57,6 @@ function returnMoneyTransfer(params) {
|
|
|
57
57
|
toLocation: depositTransaction.object.fromLocation,
|
|
58
58
|
pendingTransaction: {
|
|
59
59
|
typeOf: factory.account.transactionType.Withdraw,
|
|
60
|
-
id: '',
|
|
61
60
|
transactionNumber: publishTransactionNumber4returnMoneyTransferResult.transactionNumber
|
|
62
61
|
}
|
|
63
62
|
}
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare type ISettings = factory.project.ISettings & {
|
|
|
21
21
|
userPoolIdOld: string;
|
|
22
22
|
userPoolIdNew: string;
|
|
23
23
|
maxNumCreditCardPaymentMethod?: number;
|
|
24
|
+
useEventWorkPerformed: boolean;
|
|
24
25
|
};
|
|
25
26
|
export declare const DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD: string;
|
|
26
27
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
package/lib/chevre/settings.js
CHANGED
|
@@ -54,7 +54,7 @@ exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TR
|
|
|
54
54
|
/**
|
|
55
55
|
* グローバル設定
|
|
56
56
|
*/
|
|
57
|
-
exports.settings = Object.assign({ transactionWebhookUrls, onOrderStatusChanged: {
|
|
57
|
+
exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onOrderStatusChanged: {
|
|
58
58
|
informOrder: informOrderUrls
|
|
59
59
|
.filter((url) => url.length > 0)
|
|
60
60
|
.map((url) => {
|
|
@@ -94,4 +94,4 @@ exports.settings = Object.assign({ transactionWebhookUrls, onOrderStatusChanged:
|
|
|
94
94
|
timeout: triggerWebhookTimeout
|
|
95
95
|
}, maximumReservationGracePeriodInDays: MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS, userPoolIdOld: String(process.env.USERPOOL_ID_OLD), userPoolIdNew: String(process.env.USERPOOL_ID_NEW) }, (typeof MAX_NUM_CREDIT_CARD_PAYMENT_METHOD === 'number')
|
|
96
96
|
? { maxNumCreditCardPaymentMethod: MAX_NUM_CREDIT_CARD_PAYMENT_METHOD }
|
|
97
|
-
: undefined);
|
|
97
|
+
: undefined), { useEventWorkPerformed: process.env.USE_EVENT_WORK_PERFORMED === '1' });
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.289.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.140.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.289.0-alpha.8",
|
|
13
|
+
"@cinerino/sdk": "3.140.0-alpha.10",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"postversion": "git push origin --tags",
|
|
121
121
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
122
122
|
},
|
|
123
|
-
"version": "20.4.0-alpha.
|
|
123
|
+
"version": "20.4.0-alpha.9"
|
|
124
124
|
}
|
|
@@ -1,157 +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, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const accountTitleRepo = new chevre.repository.AccountTitle(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = accountTitleRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
// 'project.id': { $eq: project.id },
|
|
19
|
-
'project.id': { $ne: EXCLUDED_PROJECT_ID }
|
|
20
|
-
// typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries },
|
|
21
|
-
// starDate: { $gte: new Date() }
|
|
22
|
-
// _id: { $eq: 'al6aff83w' }
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
// _id: 1,
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
console.log('accountTitles found');
|
|
29
|
-
|
|
30
|
-
const additionalPropertyNamesOnCategories: string[] = [];
|
|
31
|
-
const additionalPropertyNames: string[] = [];
|
|
32
|
-
const additionalPropertyNamesOnTitles: string[] = [];
|
|
33
|
-
const projectIdsOnCategories: string[] = [];
|
|
34
|
-
const projectIds: string[] = [];
|
|
35
|
-
const projectIdsOnTitles: string[] = [];
|
|
36
|
-
const unexpextedprojectIdsOnCategories: string[] = [];
|
|
37
|
-
const unexpextedprojectIds: string[] = [];
|
|
38
|
-
const unexpextedprojectIdsOnTitles: string[] = [];
|
|
39
|
-
|
|
40
|
-
let i = 0;
|
|
41
|
-
let updateCount = 0;
|
|
42
|
-
// tslint:disable-next-line:max-func-body-length
|
|
43
|
-
await cursor.eachAsync(async (doc) => {
|
|
44
|
-
i += 1;
|
|
45
|
-
const accountTitleCategory: chevre.factory.accountTitle.IAccountTitle = doc.toObject();
|
|
46
|
-
|
|
47
|
-
const additionalPropertyNamesOnCategory = accountTitleCategory.additionalProperty?.map((p) => p.name);
|
|
48
|
-
console.log(
|
|
49
|
-
(Array.isArray(additionalPropertyNamesOnCategory)) ? additionalPropertyNamesOnCategory.length : 0,
|
|
50
|
-
'additionalPropertyNamesOnCategory found',
|
|
51
|
-
accountTitleCategory.project.id,
|
|
52
|
-
accountTitleCategory.codeValue
|
|
53
|
-
);
|
|
54
|
-
if (Array.isArray(additionalPropertyNamesOnCategory) && additionalPropertyNamesOnCategory.length > 0) {
|
|
55
|
-
console.log(
|
|
56
|
-
additionalPropertyNamesOnCategory.length,
|
|
57
|
-
'additionalPropertyNamesOnResource found',
|
|
58
|
-
accountTitleCategory.project.id,
|
|
59
|
-
accountTitleCategory.codeValue
|
|
60
|
-
);
|
|
61
|
-
additionalPropertyNamesOnCategories.push(...additionalPropertyNamesOnCategory);
|
|
62
|
-
projectIdsOnCategories.push(accountTitleCategory.project.id);
|
|
63
|
-
additionalPropertyNamesOnCategory.forEach((name) => {
|
|
64
|
-
if (!name.match(/^[a-zA-Z]*$/)) {
|
|
65
|
-
// throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
|
|
66
|
-
unexpextedprojectIdsOnCategories.push(accountTitleCategory.project.id);
|
|
67
|
-
}
|
|
68
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
69
|
-
if (name.length < 5) {
|
|
70
|
-
// throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
|
|
71
|
-
unexpextedprojectIdsOnCategories.push(accountTitleCategory.project.id);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (Array.isArray(accountTitleCategory.hasCategoryCode)) {
|
|
77
|
-
accountTitleCategory.hasCategoryCode.forEach((accountTitleSet) => {
|
|
78
|
-
const additionalPropertyNamesOnResource = accountTitleSet.additionalProperty?.map((p) => p.name);
|
|
79
|
-
console.log(
|
|
80
|
-
(Array.isArray(additionalPropertyNamesOnResource)) ? additionalPropertyNamesOnResource.length : 0,
|
|
81
|
-
'additionalPropertyNamesOnResource found',
|
|
82
|
-
accountTitleCategory.project.id,
|
|
83
|
-
accountTitleCategory.codeValue
|
|
84
|
-
);
|
|
85
|
-
if (Array.isArray(additionalPropertyNamesOnResource) && additionalPropertyNamesOnResource.length > 0) {
|
|
86
|
-
console.log(
|
|
87
|
-
additionalPropertyNamesOnResource.length,
|
|
88
|
-
'additionalPropertyNamesOnResource found',
|
|
89
|
-
accountTitleCategory.project.id,
|
|
90
|
-
accountTitleCategory.codeValue
|
|
91
|
-
);
|
|
92
|
-
additionalPropertyNames.push(...additionalPropertyNamesOnResource);
|
|
93
|
-
projectIds.push(accountTitleCategory.project.id);
|
|
94
|
-
additionalPropertyNamesOnResource.forEach((name) => {
|
|
95
|
-
if (!name.match(/^[a-zA-Z]*$/)) {
|
|
96
|
-
// throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
|
|
97
|
-
unexpextedprojectIds.push(accountTitleCategory.project.id);
|
|
98
|
-
}
|
|
99
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
100
|
-
if (name.length < 5) {
|
|
101
|
-
// throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
|
|
102
|
-
unexpextedprojectIds.push(accountTitleCategory.project.id);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (Array.isArray(accountTitleSet.hasCategoryCode)) {
|
|
108
|
-
accountTitleSet.hasCategoryCode.forEach((accountTitl) => {
|
|
109
|
-
const additionalPropertyNamesOnSection = accountTitl.additionalProperty?.map((p) => p.name);
|
|
110
|
-
console.log(
|
|
111
|
-
(Array.isArray(additionalPropertyNamesOnSection)) ? additionalPropertyNamesOnSection.length : 0,
|
|
112
|
-
'additionalPropertyNamesOnSection found',
|
|
113
|
-
accountTitleCategory.project.id,
|
|
114
|
-
accountTitleCategory.codeValue
|
|
115
|
-
);
|
|
116
|
-
if (Array.isArray(additionalPropertyNamesOnSection) && additionalPropertyNamesOnSection.length > 0) {
|
|
117
|
-
console.log(
|
|
118
|
-
additionalPropertyNamesOnSection.length,
|
|
119
|
-
'additionalPropertyNamesOnSection found',
|
|
120
|
-
accountTitleCategory.project.id,
|
|
121
|
-
accountTitleCategory.codeValue
|
|
122
|
-
);
|
|
123
|
-
additionalPropertyNamesOnTitles.push(...additionalPropertyNamesOnSection);
|
|
124
|
-
projectIdsOnTitles.push(accountTitleCategory.project.id);
|
|
125
|
-
additionalPropertyNamesOnSection.forEach((name) => {
|
|
126
|
-
if (!name.match(/^[a-zA-Z]*$/)) {
|
|
127
|
-
// throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
|
|
128
|
-
unexpextedprojectIdsOnTitles.push(accountTitleCategory.project.id);
|
|
129
|
-
}
|
|
130
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
131
|
-
if (name.length < 5) {
|
|
132
|
-
// throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
|
|
133
|
-
unexpextedprojectIdsOnTitles.push(accountTitleCategory.project.id);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
console.log(i, 'places checked');
|
|
143
|
-
console.log(updateCount, 'places updated');
|
|
144
|
-
console.log([...new Set(additionalPropertyNamesOnCategories)], 'categories');
|
|
145
|
-
console.log([...new Set(projectIdsOnCategories)], 'categories');
|
|
146
|
-
console.log([...new Set(unexpextedprojectIdsOnCategories)], 'categories');
|
|
147
|
-
console.log([...new Set(additionalPropertyNames)], 'sets');
|
|
148
|
-
console.log([...new Set(projectIds)], 'sets');
|
|
149
|
-
console.log([...new Set(unexpextedprojectIds)], 'sets');
|
|
150
|
-
console.log([...new Set(additionalPropertyNamesOnTitles)], 'titles');
|
|
151
|
-
console.log([...new Set(projectIdsOnTitles)], 'titles');
|
|
152
|
-
console.log([...new Set(unexpextedprojectIdsOnTitles)], 'titles');
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
main()
|
|
156
|
-
.then()
|
|
157
|
-
.catch(console.error);
|