@chevre/domain 20.4.0-alpha.8 → 20.4.0
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/aggregateEventReservation.ts +2 -1
- package/example/src/chevre/deleteMovieTicketCategoryChargePriceSpecs.ts +21 -0
- package/example/src/chevre/{deleteReservationTicketUnderNames.ts → deleteTasksByName.ts} +4 -2
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +96 -0
- package/example/src/chevre/reIndex.ts +25 -0
- package/example/src/chevre/searchEventTicketOffers.ts +7 -4
- package/example/src/chevre/searchOfferCatalogs.ts +14 -16
- package/example/src/chevre/searchOffersByCatalog.ts +2 -1
- package/example/src/chevre/searchProductOffers.ts +38 -0
- package/example/src/chevre/searchTasks.ts +22 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +6 -11
- package/lib/chevre/errorHandler.js +1 -0
- package/lib/chevre/repo/accountTransaction.d.ts +0 -5
- package/lib/chevre/repo/accountTransaction.js +44 -38
- package/lib/chevre/repo/assetTransaction.d.ts +1 -0
- package/lib/chevre/repo/assetTransaction.js +5 -0
- package/lib/chevre/repo/code.d.ts +0 -7
- package/lib/chevre/repo/code.js +0 -17
- package/lib/chevre/repo/event.d.ts +5 -4
- package/lib/chevre/repo/event.js +8 -17
- package/lib/chevre/repo/mongoose/model/accountTransaction.js +0 -5
- package/lib/chevre/repo/mongoose/model/member.js +5 -2
- package/lib/chevre/repo/mongoose/model/offer.js +19 -9
- package/lib/chevre/repo/mongoose/model/priceSpecification.js +19 -52
- package/lib/chevre/repo/mongoose/model/product.js +15 -2
- package/lib/chevre/repo/offer.d.ts +17 -2
- package/lib/chevre/repo/offer.js +77 -44
- package/lib/chevre/repo/offerCatalog.d.ts +3 -5
- package/lib/chevre/repo/offerCatalog.js +78 -37
- package/lib/chevre/repo/priceSpecification.d.ts +11 -0
- package/lib/chevre/repo/priceSpecification.js +44 -66
- package/lib/chevre/repo/task.d.ts +8 -0
- package/lib/chevre/repo/task.js +21 -9
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -0
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +93 -96
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +3 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +19 -11
- package/lib/chevre/service/assetTransaction/pay.js +2 -3
- package/lib/chevre/service/assetTransaction/registerService/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/registerService/factory.js +6 -3
- package/lib/chevre/service/assetTransaction/registerService.js +3 -1
- package/lib/chevre/service/assetTransaction/reserve/factory/price.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/factory/price.js +0 -7
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/reserve/factory.js +0 -1
- package/lib/chevre/service/assetTransaction/reserve.js +47 -17
- package/lib/chevre/service/assetTransaction.d.ts +1 -1
- package/lib/chevre/service/code.d.ts +0 -8
- package/lib/chevre/service/code.js +1 -38
- package/lib/chevre/service/delivery.js +12 -3
- package/lib/chevre/service/event.js +0 -3
- package/lib/chevre/service/moneyTransfer.d.ts +1 -1
- package/lib/chevre/service/moneyTransfer.js +7 -8
- package/lib/chevre/service/offer/event/authorize.js +5 -5
- package/lib/chevre/service/offer/event/factory.js +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +7 -7
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +222 -346
- package/lib/chevre/service/offer/factory.d.ts +8 -3
- package/lib/chevre/service/offer/factory.js +44 -26
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +0 -1
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +0 -1
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +11 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +15 -7
- package/lib/chevre/service/offer/product.d.ts +11 -4
- package/lib/chevre/service/offer/product.js +59 -50
- package/lib/chevre/service/payment/any/factory.js +30 -21
- package/lib/chevre/service/payment/any.js +11 -4
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +22 -0
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.js +183 -0
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +13 -0
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +45 -0
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +15 -0
- package/lib/chevre/service/{assetTransaction/pay → payment}/movieTicket/validation.js +8 -7
- package/lib/chevre/service/payment/movieTicket.d.ts +10 -22
- package/lib/chevre/service/payment/movieTicket.js +15 -210
- package/lib/chevre/service/permit.d.ts +5 -1
- package/lib/chevre/service/permit.js +18 -11
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +25 -53
- package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +5 -6
- package/lib/chevre/settings.d.ts +4 -0
- package/lib/chevre/settings.js +8 -2
- package/package.json +3 -3
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +0 -157
- package/lib/chevre/service/assetTransaction/pay/movieTicket/validation.d.ts +0 -14
- package/lib/chevre/service/task/deleteAuthorization.d.ts +0 -6
- package/lib/chevre/service/task/deleteAuthorization.js +0 -29
|
@@ -16,11 +16,12 @@ async function main() {
|
|
|
16
16
|
|
|
17
17
|
// const now = new Date();
|
|
18
18
|
await chevre.service.aggregation.event.aggregateScreeningEvent({
|
|
19
|
-
id:
|
|
19
|
+
id: String(process.env.EVENT_ID)
|
|
20
20
|
})({
|
|
21
21
|
event: new chevre.repository.Event(mongoose.connection),
|
|
22
22
|
eventAvailability: new chevre.repository.itemAvailability.ScreeningEvent(client),
|
|
23
23
|
offer: new chevre.repository.Offer(mongoose.connection),
|
|
24
|
+
offerCatalog: new chevre.repository.OfferCatalog(mongoose.connection),
|
|
24
25
|
offerRateLimit: new chevre.repository.rateLimit.Offer(client),
|
|
25
26
|
place: new chevre.repository.Place(mongoose.connection),
|
|
26
27
|
product: new chevre.repository.Product(mongoose.connection),
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const project = { id: process.env.PROJECT_ID };
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
10
|
+
|
|
11
|
+
const priceSpecificationRepo = new chevre.repository.PriceSpecification(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const result = await priceSpecificationRepo.deleteUnnecessaryMovieTicketTypeChargePriceSpecs({
|
|
14
|
+
project: { id: project.id }
|
|
15
|
+
});
|
|
16
|
+
console.log('deleted', result);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
main()
|
|
20
|
+
.then()
|
|
21
|
+
.catch(console.error);
|
|
@@ -8,9 +8,11 @@ import { chevre } from '../../../lib/index';
|
|
|
8
8
|
async function main() {
|
|
9
9
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const taskRepo = new chevre.repository.Task(mongoose.connection);
|
|
12
12
|
|
|
13
|
-
const result = await
|
|
13
|
+
const result = await taskRepo.deleteByName({
|
|
14
|
+
name: <any>'deleteAuthorization'
|
|
15
|
+
});
|
|
14
16
|
|
|
15
17
|
console.log('deleted', result);
|
|
16
18
|
}
|
|
@@ -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);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
8
|
+
|
|
9
|
+
const priceSpecificationRepo = new chevre.repository.PriceSpecification(mongoose.connection);
|
|
10
|
+
const result = await priceSpecificationRepo.reIndex();
|
|
11
|
+
console.log(result);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
main()
|
|
15
|
+
.then()
|
|
16
|
+
.catch(console.error);
|
|
17
|
+
// setInterval(
|
|
18
|
+
// () => {
|
|
19
|
+
// main()
|
|
20
|
+
// .then()
|
|
21
|
+
// .catch(console.error);
|
|
22
|
+
// },
|
|
23
|
+
// // tslint:disable-next-line:no-magic-numbers
|
|
24
|
+
// 60000
|
|
25
|
+
// );
|
|
@@ -22,11 +22,13 @@ async function main() {
|
|
|
22
22
|
const productRepo = new chevre.repository.Product(mongoose.connection);
|
|
23
23
|
|
|
24
24
|
const { ticketOffers } = await chevre.service.offer.event.searchEventTicketOffers({
|
|
25
|
-
event: { id: '
|
|
25
|
+
event: { id: 'ale6qiedq' },
|
|
26
26
|
onlyValid: true,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
validateOfferRateLimit: true,
|
|
28
|
+
addSortIndex: true,
|
|
29
|
+
limit: 100,
|
|
30
|
+
page: 1,
|
|
31
|
+
searchAddOns: true
|
|
30
32
|
// ...(typeof availableAtId === 'string') ? { store: { id: availableAtId } } : undefined
|
|
31
33
|
})({
|
|
32
34
|
event: eventRepo,
|
|
@@ -35,6 +37,7 @@ async function main() {
|
|
|
35
37
|
priceSpecification: priceSpecificationRepo,
|
|
36
38
|
product: productRepo
|
|
37
39
|
});
|
|
40
|
+
console.log(ticketOffers.map((o) => o.sortIndex));
|
|
38
41
|
console.log(ticketOffers.length);
|
|
39
42
|
}
|
|
40
43
|
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
|
-
// import * as redis from 'redis';
|
|
3
2
|
import * as mongoose from 'mongoose';
|
|
4
3
|
|
|
5
4
|
import { chevre } from '../../../lib/index';
|
|
6
5
|
|
|
6
|
+
const PROJECT_ID = process.env.PROJECT_ID;
|
|
7
|
+
|
|
7
8
|
async function main() {
|
|
8
9
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
+
const catalogRepo = new chevre.repository.OfferCatalog(mongoose.connection);
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
itemOffered: { typeOf: { $eq: chevre.factory.product.ProductType.EventService } }
|
|
24
|
-
});
|
|
25
|
-
console.log(catalogs);
|
|
13
|
+
console.log('searching...');
|
|
14
|
+
const catalogs = await catalogRepo.search(
|
|
15
|
+
{
|
|
16
|
+
project: { id: { $eq: PROJECT_ID } },
|
|
17
|
+
identifier: { $eq: '0001' },
|
|
18
|
+
sort: { identifier: chevre.factory.sortType.Descending },
|
|
19
|
+
limit: 2,
|
|
20
|
+
page: 1
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
console.log('catalogs found', catalogs.map((catalog) => `${catalog.identifier} ${catalog.numberOfItems}`));
|
|
26
24
|
console.log(catalogs.length);
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -9,13 +9,14 @@ async function main() {
|
|
|
9
9
|
|
|
10
10
|
const offerRepo = new chevre.repository.Offer(mongoose.connection);
|
|
11
11
|
|
|
12
|
-
const offers = await offerRepo.findOffersByOfferCatalogId({
|
|
12
|
+
const { offers } = await offerRepo.findOffersByOfferCatalogId({
|
|
13
13
|
ids: ['al96nqj7z', 'xxx', '1001'],
|
|
14
14
|
// ids: ['xx', 'xxx'],
|
|
15
15
|
offerCatalog: {
|
|
16
16
|
id: '0001'
|
|
17
17
|
// id: 'xxx'
|
|
18
18
|
},
|
|
19
|
+
excludeAppliesToMovieTicket: false,
|
|
19
20
|
sort: true
|
|
20
21
|
});
|
|
21
22
|
console.log(offers.map((o) => o.id));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const PROJECT_ID = process.env.PROJECT_ID;
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
10
|
+
|
|
11
|
+
const offerRepo = new chevre.repository.Offer(mongoose.connection);
|
|
12
|
+
const productRepo = new chevre.repository.Product(mongoose.connection);
|
|
13
|
+
|
|
14
|
+
const { offers } = await chevre.service.offer.product.search({
|
|
15
|
+
ids: ['7k7bbepxp', 'yyyyyy'],
|
|
16
|
+
project: { id: String(PROJECT_ID) },
|
|
17
|
+
itemOffered: { id: '62b90fef5b3eb4000b75150f' },
|
|
18
|
+
// seller?: {
|
|
19
|
+
// id: string;
|
|
20
|
+
// },
|
|
21
|
+
// availableAt?: {
|
|
22
|
+
// id: string;
|
|
23
|
+
// },
|
|
24
|
+
onlyValid: true,
|
|
25
|
+
// limit?: number,
|
|
26
|
+
// page?: number,
|
|
27
|
+
addSortIndex: false
|
|
28
|
+
})({
|
|
29
|
+
offer: offerRepo,
|
|
30
|
+
product: productRepo
|
|
31
|
+
});
|
|
32
|
+
console.log(offers.map((o) => `${o.sortIndex} ${o.id}`));
|
|
33
|
+
console.log(offers.length);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
main()
|
|
37
|
+
.then(console.log)
|
|
38
|
+
.catch(console.error);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
8
|
+
|
|
9
|
+
const taskRepo = new chevre.repository.Task(mongoose.connection);
|
|
10
|
+
|
|
11
|
+
const tasks = await taskRepo.search({
|
|
12
|
+
limit: 100,
|
|
13
|
+
page: 1,
|
|
14
|
+
id: { $eq: '63b7a54d8ba861284895937f' }
|
|
15
|
+
});
|
|
16
|
+
console.log(tasks);
|
|
17
|
+
console.log(tasks.length);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
main()
|
|
21
|
+
.then(console.log)
|
|
22
|
+
.catch(console.error);
|
|
@@ -6,19 +6,14 @@ import { chevre } from '../../../lib/index';
|
|
|
6
6
|
async function main() {
|
|
7
7
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
const permitRepo = new chevre.repository.ServiceOutput(mongoose.connection);
|
|
9
|
+
const offerRepo = new chevre.repository.Offer(mongoose.connection);
|
|
11
10
|
|
|
12
|
-
let updateResult
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
let updateResult: any;
|
|
12
|
+
updateResult = await offerRepo.unsetUnnecessaryFields({
|
|
13
|
+
filter: { 'category.project': { $exists: true } },
|
|
14
|
+
$unset: { 'category.project': 1 }
|
|
15
15
|
});
|
|
16
|
-
console.log('
|
|
17
|
-
updateResult = await permitRepo.unsetUnnecessaryFields({
|
|
18
|
-
filter: { 'paymentAccount.accountType': { $exists: true } },
|
|
19
|
-
$unset: { 'paymentAccount.accountType': 1 }
|
|
20
|
-
});
|
|
21
|
-
console.log('permits unset', updateResult);
|
|
16
|
+
console.log('offers unset', updateResult);
|
|
22
17
|
}
|
|
23
18
|
|
|
24
19
|
main()
|
|
@@ -19,6 +19,7 @@ function handleMongoError(error) {
|
|
|
19
19
|
if (handledError instanceof mongoose_1.mongo.MongoError) {
|
|
20
20
|
switch (handledError.code) {
|
|
21
21
|
case MongoErrorCode.DuplicateKey:
|
|
22
|
+
handledError = new factory_1.errors.AlreadyInUse('', [], `Some fields already in use. code:${handledError.code} message:${handledError.message}`);
|
|
22
23
|
// no op
|
|
23
24
|
break;
|
|
24
25
|
case MongoErrorCode.MaxTimeMSExpired:
|
|
@@ -47,18 +47,13 @@ export declare class MongoRepository {
|
|
|
47
47
|
/**
|
|
48
48
|
* タスク未エクスポートの取引をひとつ取得してエクスポートを開始する
|
|
49
49
|
*/
|
|
50
|
-
startExportTasks<T extends factory.account.transactionType>(status: factory.transactionStatusType): Promise<factory.account.transaction.ITransaction<T> | null>;
|
|
51
50
|
/**
|
|
52
51
|
* タスクエクスポートリトライ
|
|
53
52
|
* TODO updatedAtを基準にしているが、タスクエクスポートトライ日時を持たせた方が安全か?
|
|
54
53
|
*/
|
|
55
|
-
reexportTasks(params: {
|
|
56
|
-
intervalInMinutes: number;
|
|
57
|
-
}): Promise<void>;
|
|
58
54
|
/**
|
|
59
55
|
* タスクをエクスポート済に変更する
|
|
60
56
|
*/
|
|
61
|
-
setTasksExportedById(transactionId: string): Promise<void>;
|
|
62
57
|
/**
|
|
63
58
|
* 取引を期限切れにする
|
|
64
59
|
*/
|
|
@@ -76,7 +76,7 @@ class MongoRepository {
|
|
|
76
76
|
*/
|
|
77
77
|
start(params) {
|
|
78
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
return this.transactionModel.create(Object.assign(Object.assign({}, params), { status: factory.transactionStatusType.InProgress, startDate: new Date(), endDate: undefined
|
|
79
|
+
return this.transactionModel.create(Object.assign(Object.assign({}, params), { status: factory.transactionStatusType.InProgress, startDate: new Date(), endDate: undefined }))
|
|
80
80
|
.then((doc) => doc.toObject());
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -94,7 +94,7 @@ class MongoRepository {
|
|
|
94
94
|
$in: [factory.transactionStatusType.InProgress, factory.transactionStatusType.Confirmed]
|
|
95
95
|
}
|
|
96
96
|
}, {
|
|
97
|
-
$setOnInsert: Object.assign(Object.assign({}, params), { status: factory.transactionStatusType.InProgress, startDate: startDate, endDate: undefined
|
|
97
|
+
$setOnInsert: Object.assign(Object.assign({}, params), { status: factory.transactionStatusType.InProgress, startDate: startDate, endDate: undefined })
|
|
98
98
|
}, {
|
|
99
99
|
new: true,
|
|
100
100
|
upsert: true
|
|
@@ -225,50 +225,56 @@ class MongoRepository {
|
|
|
225
225
|
/**
|
|
226
226
|
* タスク未エクスポートの取引をひとつ取得してエクスポートを開始する
|
|
227
227
|
*/
|
|
228
|
-
startExportTasks(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
228
|
+
// public async startExportTasks<T extends factory.account.transactionType>(
|
|
229
|
+
// status: factory.transactionStatusType
|
|
230
|
+
// ): Promise<factory.account.transaction.ITransaction<T> | null> {
|
|
231
|
+
// return this.transactionModel.findOneAndUpdate(
|
|
232
|
+
// {
|
|
233
|
+
// status: status,
|
|
234
|
+
// tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
235
|
+
// },
|
|
236
|
+
// { tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting },
|
|
237
|
+
// { new: true }
|
|
238
|
+
// )
|
|
239
|
+
// .exec()
|
|
240
|
+
// // tslint:disable-next-line:no-null-keyword
|
|
241
|
+
// .then((doc) => (doc === null) ? null : doc.toObject());
|
|
242
|
+
// }
|
|
239
243
|
// tslint:disable-next-line:no-suspicious-comment
|
|
240
244
|
/**
|
|
241
245
|
* タスクエクスポートリトライ
|
|
242
246
|
* TODO updatedAtを基準にしているが、タスクエクスポートトライ日時を持たせた方が安全か?
|
|
243
247
|
*/
|
|
244
|
-
reexportTasks(params) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
248
|
+
// public async reexportTasks(params: { intervalInMinutes: number }): Promise<void> {
|
|
249
|
+
// await this.transactionModel.updateMany(
|
|
250
|
+
// {
|
|
251
|
+
// tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting,
|
|
252
|
+
// updatedAt: {
|
|
253
|
+
// $lt: moment()
|
|
254
|
+
// .add(-params.intervalInMinutes, 'minutes')
|
|
255
|
+
// .toDate()
|
|
256
|
+
// }
|
|
257
|
+
// },
|
|
258
|
+
// {
|
|
259
|
+
// tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
260
|
+
// }
|
|
261
|
+
// )
|
|
262
|
+
// .exec();
|
|
263
|
+
// }
|
|
259
264
|
/**
|
|
260
265
|
* タスクをエクスポート済に変更する
|
|
261
266
|
*/
|
|
262
|
-
setTasksExportedById(transactionId) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
267
|
+
// public async setTasksExportedById(transactionId: string): Promise<void> {
|
|
268
|
+
// await this.transactionModel.findByIdAndUpdate(
|
|
269
|
+
// transactionId,
|
|
270
|
+
// {
|
|
271
|
+
// tasksExportationStatus: factory.transactionTasksExportationStatus.Exported,
|
|
272
|
+
// tasksExportedAt: moment()
|
|
273
|
+
// .toDate()
|
|
274
|
+
// }
|
|
275
|
+
// )
|
|
276
|
+
// .exec();
|
|
277
|
+
// }
|
|
272
278
|
/**
|
|
273
279
|
* 取引を期限切れにする
|
|
274
280
|
*/
|
|
@@ -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([
|
|
@@ -35,13 +35,6 @@ export declare class MongoRepository {
|
|
|
35
35
|
}): Promise<IObject>;
|
|
36
36
|
count(params: factory.authorization.ISearchConditions): Promise<number>;
|
|
37
37
|
search(params: factory.authorization.ISearchConditions): Promise<factory.authorization.IAuthorization[]>;
|
|
38
|
-
deleteByCode(params: {
|
|
39
|
-
code: string;
|
|
40
|
-
}): Promise<{
|
|
41
|
-
n?: number;
|
|
42
|
-
ok?: number;
|
|
43
|
-
deletedCount?: number;
|
|
44
|
-
} | null>;
|
|
45
38
|
/**
|
|
46
39
|
* 有効期限を一定期間過ぎた承認を削除する
|
|
47
40
|
*/
|
package/lib/chevre/repo/code.js
CHANGED
|
@@ -204,23 +204,6 @@ class MongoRepository {
|
|
|
204
204
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
-
deleteByCode(params) {
|
|
208
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
-
return this.authorizationModel.deleteOne({
|
|
210
|
-
code: { $exists: true, $eq: params.code }
|
|
211
|
-
})
|
|
212
|
-
.exec()
|
|
213
|
-
.then((result) => {
|
|
214
|
-
return {
|
|
215
|
-
n: result === null || result === void 0 ? void 0 : result.n,
|
|
216
|
-
// opTime: result.opTime,
|
|
217
|
-
ok: result === null || result === void 0 ? void 0 : result.ok,
|
|
218
|
-
// operationTime,
|
|
219
|
-
deletedCount: result === null || result === void 0 ? void 0 : result.deletedCount
|
|
220
|
-
};
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
207
|
/**
|
|
225
208
|
* 有効期限を一定期間過ぎた承認を削除する
|
|
226
209
|
*/
|
|
@@ -10,7 +10,7 @@ export interface IUpdateAggregateReservationParams {
|
|
|
10
10
|
$set: {
|
|
11
11
|
updatedAt: Date;
|
|
12
12
|
aggregateReservation: factory.event.screeningEvent.IAggregateReservation;
|
|
13
|
-
aggregateOffer
|
|
13
|
+
aggregateOffer?: factory.event.screeningEvent.IAggregateOffer;
|
|
14
14
|
maximumAttendeeCapacity?: number;
|
|
15
15
|
remainingAttendeeCapacity?: number;
|
|
16
16
|
checkInCount?: number;
|
|
@@ -141,9 +141,10 @@ export declare class MongoRepository {
|
|
|
141
141
|
}, update: IUpdateAggregateReservationParams | IUpdateAggregateUseActionsParams): Promise<factory.event.IEvent<T>>;
|
|
142
142
|
bulkWrite(bulkWriteOps: any[]): Promise<BulkWriteOpResultObject>;
|
|
143
143
|
getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
unsetUnnecessaryFields(params: {
|
|
145
|
+
filter: any;
|
|
146
|
+
$unset: any;
|
|
147
|
+
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
147
148
|
aggregateEvent(params: {
|
|
148
149
|
project?: {
|
|
149
150
|
id?: {
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -638,14 +638,14 @@ class MongoRepository {
|
|
|
638
638
|
return __awaiter(this, void 0, void 0, function* () {
|
|
639
639
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
640
640
|
const positiveProjectionExists = (projection !== undefined && projection !== null)
|
|
641
|
-
? Object.
|
|
642
|
-
.some((
|
|
641
|
+
? Object.values(projection)
|
|
642
|
+
.some((value) => value !== 0)
|
|
643
643
|
: false;
|
|
644
644
|
const query = this.eventModel.find({ $and: conditions },
|
|
645
645
|
// :1対応(2023-01-25~)
|
|
646
646
|
(positiveProjectionExists)
|
|
647
647
|
? projection
|
|
648
|
-
: Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }
|
|
648
|
+
: Object.assign(Object.assign({}, projection), { __v: 0, createdAt: 0, updatedAt: 0 }));
|
|
649
649
|
if (typeof params.limit === 'number') {
|
|
650
650
|
const page = (typeof params.page === 'number') ? params.page : 1;
|
|
651
651
|
query.limit(params.limit)
|
|
@@ -680,14 +680,14 @@ class MongoRepository {
|
|
|
680
680
|
findById(params, projection) {
|
|
681
681
|
return __awaiter(this, void 0, void 0, function* () {
|
|
682
682
|
const positiveProjectionExists = (projection !== undefined && projection !== null)
|
|
683
|
-
? Object.
|
|
684
|
-
.some((
|
|
683
|
+
? Object.values(projection)
|
|
684
|
+
.some((value) => value !== 0)
|
|
685
685
|
: false;
|
|
686
686
|
const doc = yield this.eventModel.findOne({ _id: params.id },
|
|
687
687
|
// :1対応(2023-01-25~)
|
|
688
688
|
(positiveProjectionExists)
|
|
689
689
|
? projection
|
|
690
|
-
: Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }
|
|
690
|
+
: Object.assign(Object.assign({}, projection), { __v: 0, createdAt: 0, updatedAt: 0 }))
|
|
691
691
|
.exec();
|
|
692
692
|
if (doc === null) {
|
|
693
693
|
throw new factory.errors.NotFound(this.eventModel.modelName);
|
|
@@ -751,18 +751,9 @@ class MongoRepository {
|
|
|
751
751
|
.sort({ startDate: factory.sortType.Descending })
|
|
752
752
|
.cursor();
|
|
753
753
|
}
|
|
754
|
-
|
|
754
|
+
unsetUnnecessaryFields(params) {
|
|
755
755
|
return __awaiter(this, void 0, void 0, function* () {
|
|
756
|
-
|
|
757
|
-
_id: { $eq: params.id }
|
|
758
|
-
}, {
|
|
759
|
-
$unset: {
|
|
760
|
-
'location.project': 1,
|
|
761
|
-
'workPerformed.project': 1,
|
|
762
|
-
'superEvent.location.project': 1,
|
|
763
|
-
'superEvent.workPerformed.project': 1
|
|
764
|
-
}
|
|
765
|
-
})
|
|
756
|
+
return this.eventModel.updateMany(params.filter, { $unset: params.$unset })
|
|
766
757
|
.exec();
|
|
767
758
|
});
|
|
768
759
|
}
|
|
@@ -25,15 +25,10 @@ const schema = new mongoose.Schema({
|
|
|
25
25
|
},
|
|
26
26
|
agent: mongoose.SchemaTypes.Mixed,
|
|
27
27
|
recipient: mongoose.SchemaTypes.Mixed,
|
|
28
|
-
error: mongoose.SchemaTypes.Mixed,
|
|
29
|
-
result: mongoose.SchemaTypes.Mixed,
|
|
30
28
|
object: mongoose.SchemaTypes.Mixed,
|
|
31
29
|
expires: Date,
|
|
32
30
|
startDate: Date,
|
|
33
31
|
endDate: Date,
|
|
34
|
-
dateReturned: Date,
|
|
35
|
-
tasksExportedAt: Date,
|
|
36
|
-
tasksExportationStatus: String,
|
|
37
32
|
potentialActions: mongoose.SchemaTypes.Mixed
|
|
38
33
|
}, {
|
|
39
34
|
collection: 'accountTransactions',
|