@chevre/domain 22.12.0-alpha.0 → 22.12.0-alpha.1
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.
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// tslint:disable-next-line:max-func-body-length
|
|
7
|
+
async function main() {
|
|
8
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
|
+
|
|
10
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
11
|
+
|
|
12
|
+
const cursor = eventRepo.getCursor(
|
|
13
|
+
{
|
|
14
|
+
// _id: { $eq: 'bm2bftkoj' },
|
|
15
|
+
'location.maximumAttendeeCapacity': { $exists: true }
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
_id: 1,
|
|
19
|
+
startDate: 1,
|
|
20
|
+
project: 1,
|
|
21
|
+
location: 1,
|
|
22
|
+
maximumPhysicalAttendeeCapacity: 1,
|
|
23
|
+
typeOf: 1
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
console.log('events found');
|
|
27
|
+
|
|
28
|
+
let i = 0;
|
|
29
|
+
let updateCount = 0;
|
|
30
|
+
await cursor.eachAsync(async (doc) => {
|
|
31
|
+
i += 1;
|
|
32
|
+
const event: Pick<
|
|
33
|
+
chevre.factory.event.screeningEvent.IEvent,
|
|
34
|
+
'id' | 'location' | 'startDate' | 'project' | 'maximumPhysicalAttendeeCapacity' | 'typeOf'
|
|
35
|
+
> = doc.toObject();
|
|
36
|
+
|
|
37
|
+
console.log(
|
|
38
|
+
'alreadyMigrated?', event.project.id, event.id, event.startDate, i);
|
|
39
|
+
const originCapacity = event.location.maximumAttendeeCapacity;
|
|
40
|
+
const alreadyMigrated = typeof originCapacity !== 'number'
|
|
41
|
+
|| (typeof originCapacity === 'number' && originCapacity === event.maximumPhysicalAttendeeCapacity);
|
|
42
|
+
|
|
43
|
+
if (alreadyMigrated) {
|
|
44
|
+
console.log(
|
|
45
|
+
'already migrated.', event.project.id, event.id, event.startDate, i);
|
|
46
|
+
} else {
|
|
47
|
+
if (typeof originCapacity === 'number') {
|
|
48
|
+
console.log(
|
|
49
|
+
'updating project... maximumPhysicalAttendeeCapacity:',
|
|
50
|
+
originCapacity,
|
|
51
|
+
event.project.id, event.id, event.startDate, i);
|
|
52
|
+
await eventRepo.updatePartiallyById({
|
|
53
|
+
project: { id: event.project.id },
|
|
54
|
+
id: event.id,
|
|
55
|
+
attributes: {
|
|
56
|
+
typeOf: event.typeOf,
|
|
57
|
+
...{
|
|
58
|
+
maximumPhysicalAttendeeCapacity: originCapacity
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
updateCount += 1;
|
|
63
|
+
console.log(
|
|
64
|
+
'updated.',
|
|
65
|
+
event.project.id, event.id, event.startDate, i);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
console.log(i, 'events checked');
|
|
71
|
+
console.log(updateCount, 'events updated');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
main()
|
|
75
|
+
.then()
|
|
76
|
+
.catch(console.error);
|
|
@@ -11,7 +11,7 @@ mongoose.Model.on('index', (...args) => {
|
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
13
|
|
|
14
|
-
await chevre.repository.
|
|
14
|
+
await chevre.repository.Product.createInstance(mongoose.connection);
|
|
15
15
|
console.log('success!');
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -184,6 +184,7 @@ interface IFindAuthorizeActionResult {
|
|
|
184
184
|
* アクションスタータス
|
|
185
185
|
*/
|
|
186
186
|
actionStatus: factory.actionStatusType;
|
|
187
|
+
object?: Pick<factory.action.authorize.paymentMethod.any.IObject, 'paymentMethodId'>;
|
|
187
188
|
/**
|
|
188
189
|
* エラー
|
|
189
190
|
*/
|
|
@@ -221,6 +222,7 @@ interface IFindAcceptActionResult {
|
|
|
221
222
|
* アクションスタータス
|
|
222
223
|
*/
|
|
223
224
|
actionStatus: factory.actionStatusType;
|
|
225
|
+
object?: Pick<factory.action.accept.pay.IObject, 'transactionNumber'>;
|
|
224
226
|
/**
|
|
225
227
|
* エラー
|
|
226
228
|
*/
|
|
@@ -636,7 +636,10 @@ function findAuthorizeAction(params) {
|
|
|
636
636
|
if (((_b = authorizeAction.purpose) === null || _b === void 0 ? void 0 : _b.id) !== params.purpose.id) {
|
|
637
637
|
throw new factory.errors.NotFound('Action');
|
|
638
638
|
}
|
|
639
|
-
|
|
639
|
+
const authorizeActionWithObject = yield repos.action.findById({ id: authorizeAction.id, typeOf: factory.actionType.AuthorizeAction }, ['object'], []);
|
|
640
|
+
action = Object.assign({ id: authorizeAction.id, actionStatus: authorizeAction.actionStatus,
|
|
641
|
+
// add object.paymentMethodId(2025-08-26~)
|
|
642
|
+
object: { paymentMethodId: authorizeActionWithObject.object.paymentMethodId } }, (authorizeAction.error !== undefined)
|
|
640
643
|
? {
|
|
641
644
|
error: (Array.isArray(authorizeAction.error))
|
|
642
645
|
? authorizeAction.error[0]
|
|
@@ -741,8 +744,10 @@ function findAcceptAction(params) {
|
|
|
741
744
|
if (((_b = acceptAction.purpose) === null || _b === void 0 ? void 0 : _b.id) !== params.purpose.id) {
|
|
742
745
|
throw new factory.errors.NotFound('Action');
|
|
743
746
|
}
|
|
744
|
-
const acceptActionWithResult = yield repos.action.findById({ id: acceptAction.id, typeOf: factory.actionType.AcceptAction }, ['result'], []);
|
|
745
|
-
action = Object.assign(Object.assign({ id: acceptAction.id, actionStatus: acceptAction.actionStatus
|
|
747
|
+
const acceptActionWithResult = yield repos.action.findById({ id: acceptAction.id, typeOf: factory.actionType.AcceptAction }, ['result', 'object'], []);
|
|
748
|
+
action = Object.assign(Object.assign({ id: acceptAction.id, actionStatus: acceptAction.actionStatus,
|
|
749
|
+
// add object.transactionNumber(2025-08-26~)
|
|
750
|
+
object: { transactionNumber: acceptActionWithResult.object.transactionNumber } }, (acceptAction.error !== undefined)
|
|
746
751
|
? {
|
|
747
752
|
error: (Array.isArray(acceptAction.error))
|
|
748
753
|
? acceptAction.error[0]
|
package/package.json
CHANGED