@chevre/domain 24.1.0-alpha.1 → 24.1.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/README.md +0 -2
- package/lib/chevre/repo/acceptedOffer.d.ts +1 -1
- package/lib/chevre/repo/acceptedOffer.js +10 -10
- package/lib/chevre/repo/accountingReport.d.ts +9 -2
- package/lib/chevre/repo/accountingReport.js +30 -28
- package/lib/chevre/repo/action/actionProcess.d.ts +1 -1
- package/lib/chevre/repo/aggregateReservation.d.ts +6 -0
- package/lib/chevre/repo/aggregateReservation.js +9 -0
- package/lib/chevre/repo/assetTransaction/reserve.d.ts +1 -0
- package/lib/chevre/repo/assetTransaction/reserve.js +2 -1
- package/lib/chevre/repo/factory/reservation/createMongoConditions.js +155 -180
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +52 -51
- package/lib/chevre/repo/mongoose/schemas/order.js +108 -108
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +1 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.js +117 -117
- package/lib/chevre/repo/order.d.ts +2 -1
- package/lib/chevre/repo/order.js +171 -170
- package/lib/chevre/repo/project.d.ts +0 -3
- package/lib/chevre/repo/project.js +0 -10
- package/lib/chevre/repo/reservation.d.ts +3 -4
- package/lib/chevre/repo/reservation.js +13 -10
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +17 -26
- package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +14 -11
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -3
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +67 -72
- package/lib/chevre/service/reserve/confirmReservation.js +7 -7
- package/lib/chevre/service/reserve/factory.js +2 -1
- package/lib/chevre/service/reserve/findReservations.d.ts +3 -1
- package/lib/chevre/service/reserve/findReservations.js +11 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +2 -1
- package/lib/chevre/service/reserve/useReservation.d.ts +1 -1
- package/lib/chevre/service/reserve/useReservation.js +20 -24
- package/lib/chevre/service/task/createAccountingReport.js +11 -9
- package/lib/chevre/service/task/useReservation.d.ts +2 -2
- package/lib/chevre/service/task/useReservation.js +6 -18
- package/lib/chevre/service/taskHandler.js +1 -0
- package/package.json +2 -2
- package/lib/chevre/repo/mongoose/schemas/productModel.d.ts +0 -33
- package/lib/chevre/repo/mongoose/schemas/productModel.js +0 -57
|
@@ -32,13 +32,14 @@ interface IAggregateOrder {
|
|
|
32
32
|
export type IOrderOnStatusChanged = Pick<IOrderWithoutAcceptedOffers & {
|
|
33
33
|
id: string;
|
|
34
34
|
}, 'id' | 'orderNumber' | 'broker' | 'confirmationNumber' | 'customer' | 'dateReturned' | 'name' | 'orderDate' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'previousOrderStatus' | 'price' | 'priceCurrency' | 'project' | 'returner' | 'seller' | 'typeOf'>;
|
|
35
|
+
type ISearchConditions = Pick<factory.order.ISearchConditions, 'acceptedOffers' | 'broker' | 'confirmationNumbers' | 'customer' | 'name' | 'orderDate' | 'orderNumbers' | 'orderStatuses' | 'paymentMethods' | 'project' | 'provider' | 'seller'>;
|
|
35
36
|
/**
|
|
36
37
|
* 注文リポジトリ
|
|
37
38
|
*/
|
|
38
39
|
export declare class OrderRepo {
|
|
39
40
|
private readonly orderModel;
|
|
40
41
|
constructor(connection: Connection);
|
|
41
|
-
static CREATE_MONGO_CONDITIONS(params:
|
|
42
|
+
static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery<factory.order.IOrder>[];
|
|
42
43
|
/**
|
|
43
44
|
* なければ作成する
|
|
44
45
|
*/
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -31,27 +31,27 @@ class OrderRepo {
|
|
|
31
31
|
if (typeof projectIdEq === 'string') {
|
|
32
32
|
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
33
33
|
}
|
|
34
|
-
/* istanbul ignore else */
|
|
35
|
-
if (params.identifier !== undefined) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
34
|
+
// /* istanbul ignore else */
|
|
35
|
+
// if (params.identifier !== undefined) {
|
|
36
|
+
// /* istanbul ignore else */
|
|
37
|
+
// if (Array.isArray(params.identifier.$all)) {
|
|
38
|
+
// andConditions.push({
|
|
39
|
+
// identifier: {
|
|
40
|
+
// $exists: true,
|
|
41
|
+
// $all: params.identifier.$all
|
|
42
|
+
// }
|
|
43
|
+
// });
|
|
44
|
+
// }
|
|
45
|
+
// /* istanbul ignore else */
|
|
46
|
+
// if (Array.isArray(params.identifier.$in)) {
|
|
47
|
+
// andConditions.push({
|
|
48
|
+
// identifier: {
|
|
49
|
+
// $exists: true,
|
|
50
|
+
// $in: params.identifier.$in
|
|
51
|
+
// }
|
|
52
|
+
// });
|
|
53
|
+
// }
|
|
54
|
+
// }
|
|
55
55
|
const providerIdEq = params.provider?.id?.$eq;
|
|
56
56
|
if (typeof providerIdEq === 'string') {
|
|
57
57
|
andConditions.push({ 'seller.id': { $exists: true, $eq: providerIdEq } });
|
|
@@ -129,44 +129,44 @@ class OrderRepo {
|
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
if (params.customer.additionalProperty !== undefined && params.customer.additionalProperty !== null) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
if (params.customer.memberOf !== undefined && params.customer.memberOf !== null) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
132
|
+
// if (params.customer.additionalProperty !== undefined && params.customer.additionalProperty !== null) {
|
|
133
|
+
// if (Array.isArray(params.customer.additionalProperty.$all)) {
|
|
134
|
+
// andConditions.push({
|
|
135
|
+
// 'customer.additionalProperty': {
|
|
136
|
+
// $exists: true,
|
|
137
|
+
// $all: params.customer.additionalProperty.$all
|
|
138
|
+
// }
|
|
139
|
+
// });
|
|
140
|
+
// }
|
|
141
|
+
// if (Array.isArray(params.customer.additionalProperty.$in)) {
|
|
142
|
+
// andConditions.push({
|
|
143
|
+
// 'customer.additionalProperty': {
|
|
144
|
+
// $exists: true,
|
|
145
|
+
// $in: params.customer.additionalProperty.$in
|
|
146
|
+
// }
|
|
147
|
+
// });
|
|
148
|
+
// }
|
|
149
|
+
// }
|
|
150
|
+
// if (params.customer.memberOf !== undefined && params.customer.memberOf !== null) {
|
|
151
|
+
// if (params.customer.memberOf.membershipNumber !== undefined && params.customer.memberOf.membershipNumber !== null) {
|
|
152
|
+
// if (typeof params.customer.memberOf.membershipNumber.$eq === 'string') {
|
|
153
|
+
// andConditions.push({
|
|
154
|
+
// 'customer.memberOf.membershipNumber': {
|
|
155
|
+
// $exists: true,
|
|
156
|
+
// $eq: params.customer.memberOf.membershipNumber.$eq
|
|
157
|
+
// }
|
|
158
|
+
// });
|
|
159
|
+
// }
|
|
160
|
+
// if (Array.isArray(params.customer.memberOf.membershipNumber.$in)) {
|
|
161
|
+
// andConditions.push({
|
|
162
|
+
// 'customer.memberOf.membershipNumber': {
|
|
163
|
+
// $exists: true,
|
|
164
|
+
// $in: params.customer.memberOf.membershipNumber.$in
|
|
165
|
+
// }
|
|
166
|
+
// });
|
|
167
|
+
// }
|
|
168
|
+
// }
|
|
169
|
+
// }
|
|
170
170
|
if (typeof params.customer.givenName === 'string') {
|
|
171
171
|
if (params.customer.givenName.length > 0) {
|
|
172
172
|
andConditions.push({
|
|
@@ -325,72 +325,73 @@ class OrderRepo {
|
|
|
325
325
|
andConditions.push({ confirmationNumber: { $exists: true, $in: params.confirmationNumbers } });
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
const orderedItemSize = params.orderedItem?.$size;
|
|
329
|
-
if (typeof orderedItemSize === 'number') {
|
|
330
|
-
|
|
331
|
-
}
|
|
332
|
-
const acceptedOffersSize = params.acceptedOffers?.$size;
|
|
333
|
-
if (typeof acceptedOffersSize === 'number') {
|
|
334
|
-
|
|
335
|
-
}
|
|
328
|
+
// const orderedItemSize = params.orderedItem?.$size;
|
|
329
|
+
// if (typeof orderedItemSize === 'number') {
|
|
330
|
+
// andConditions.push({ orderedItem: { $size: orderedItemSize } });
|
|
331
|
+
// }
|
|
332
|
+
// const acceptedOffersSize = params.acceptedOffers?.$size;
|
|
333
|
+
// if (typeof acceptedOffersSize === 'number') {
|
|
334
|
+
// andConditions.push({ acceptedOffers: { $size: acceptedOffersSize } });
|
|
335
|
+
// }
|
|
336
336
|
const serialNumberEq = params.acceptedOffers?.serialNumber?.$eq;
|
|
337
337
|
if (typeof serialNumberEq === 'string') {
|
|
338
338
|
andConditions.push({ 'acceptedOffers.serialNumber': { $exists: true, $eq: serialNumberEq } });
|
|
339
339
|
}
|
|
340
|
-
const itemOfferedIdentifierIn = params.acceptedOffers?.itemOffered?.identifier?.$in;
|
|
341
|
-
if (Array.isArray(itemOfferedIdentifierIn)) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
const itemOfferedTypeOfIn = params.acceptedOffers?.itemOffered?.typeOf?.$in;
|
|
350
|
-
if (Array.isArray(itemOfferedTypeOfIn)) {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
const itemOfferedIssuedThroughTypeOfEq = params.acceptedOffers?.itemOffered?.issuedThrough?.typeOf?.$eq;
|
|
359
|
-
if (typeof itemOfferedIssuedThroughTypeOfEq === 'string') {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
const itemOfferedIssuedThroughIdIn = params.acceptedOffers?.itemOffered?.issuedThrough?.id?.$in;
|
|
368
|
-
if (Array.isArray(itemOfferedIssuedThroughIdIn)) {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
const itemOfferedProgramMembershipUsedIdentifierEq = params.acceptedOffers?.itemOffered?.programMembershipUsed?.identifier?.$eq;
|
|
377
|
-
if (typeof itemOfferedProgramMembershipUsedIdentifierEq === 'string') {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq =
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}
|
|
340
|
+
// const itemOfferedIdentifierIn = params.acceptedOffers?.itemOffered?.identifier?.$in;
|
|
341
|
+
// if (Array.isArray(itemOfferedIdentifierIn)) {
|
|
342
|
+
// andConditions.push({
|
|
343
|
+
// 'acceptedOffers.itemOffered.identifier': {
|
|
344
|
+
// $exists: true,
|
|
345
|
+
// $in: itemOfferedIdentifierIn
|
|
346
|
+
// }
|
|
347
|
+
// });
|
|
348
|
+
// }
|
|
349
|
+
// const itemOfferedTypeOfIn = params.acceptedOffers?.itemOffered?.typeOf?.$in;
|
|
350
|
+
// if (Array.isArray(itemOfferedTypeOfIn)) {
|
|
351
|
+
// andConditions.push({
|
|
352
|
+
// 'acceptedOffers.itemOffered.typeOf': {
|
|
353
|
+
// $exists: true,
|
|
354
|
+
// $in: itemOfferedTypeOfIn
|
|
355
|
+
// }
|
|
356
|
+
// });
|
|
357
|
+
// }
|
|
358
|
+
// const itemOfferedIssuedThroughTypeOfEq = params.acceptedOffers?.itemOffered?.issuedThrough?.typeOf?.$eq;
|
|
359
|
+
// if (typeof itemOfferedIssuedThroughTypeOfEq === 'string') {
|
|
360
|
+
// andConditions.push({
|
|
361
|
+
// 'acceptedOffers.itemOffered.issuedThrough.typeOf': {
|
|
362
|
+
// $exists: true,
|
|
363
|
+
// $eq: itemOfferedIssuedThroughTypeOfEq
|
|
364
|
+
// }
|
|
365
|
+
// });
|
|
366
|
+
// }
|
|
367
|
+
// const itemOfferedIssuedThroughIdIn = params.acceptedOffers?.itemOffered?.issuedThrough?.id?.$in;
|
|
368
|
+
// if (Array.isArray(itemOfferedIssuedThroughIdIn)) {
|
|
369
|
+
// andConditions.push({
|
|
370
|
+
// 'acceptedOffers.itemOffered.issuedThrough.id': {
|
|
371
|
+
// $exists: true,
|
|
372
|
+
// $in: itemOfferedIssuedThroughIdIn
|
|
373
|
+
// }
|
|
374
|
+
// });
|
|
375
|
+
// }
|
|
376
|
+
// const itemOfferedProgramMembershipUsedIdentifierEq = params.acceptedOffers?.itemOffered?.programMembershipUsed?.identifier?.$eq;
|
|
377
|
+
// if (typeof itemOfferedProgramMembershipUsedIdentifierEq === 'string') {
|
|
378
|
+
// andConditions.push({
|
|
379
|
+
// 'acceptedOffers.itemOffered.programMembershipUsed.identifier': {
|
|
380
|
+
// $exists: true,
|
|
381
|
+
// $eq: itemOfferedProgramMembershipUsedIdentifierEq
|
|
382
|
+
// }
|
|
383
|
+
// });
|
|
384
|
+
// }
|
|
385
|
+
// const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq =
|
|
386
|
+
// params.acceptedOffers?.itemOffered?.programMembershipUsed?.issuedThrough?.serviceType?.codeValue?.$eq;
|
|
387
|
+
// if (typeof itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq === 'string') {
|
|
388
|
+
// andConditions.push({
|
|
389
|
+
// 'acceptedOffers.itemOffered.programMembershipUsed.issuedThrough.serviceType.codeValue': {
|
|
390
|
+
// $exists: true,
|
|
391
|
+
// $eq: itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq
|
|
392
|
+
// }
|
|
393
|
+
// });
|
|
394
|
+
// }
|
|
394
395
|
const itemOfferedReservedTicketIdentifierEq = params.acceptedOffers?.itemOffered?.reservedTicket?.identifier?.$eq;
|
|
395
396
|
if (typeof itemOfferedReservedTicketIdentifierEq === 'string') {
|
|
396
397
|
andConditions.push({
|
|
@@ -434,25 +435,25 @@ class OrderRepo {
|
|
|
434
435
|
}
|
|
435
436
|
});
|
|
436
437
|
}
|
|
437
|
-
/* istanbul ignore else */
|
|
438
|
-
if (typeof reservationForConditions.name === 'string' && reservationForConditions.name.length > 0) {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
438
|
+
// /* istanbul ignore else */
|
|
439
|
+
// if (typeof reservationForConditions.name === 'string' && reservationForConditions.name.length > 0) {
|
|
440
|
+
// andConditions.push({
|
|
441
|
+
// $or: [
|
|
442
|
+
// {
|
|
443
|
+
// 'acceptedOffers.itemOffered.reservationFor.name.ja': {
|
|
444
|
+
// $exists: true,
|
|
445
|
+
// $regex: new RegExp(reservationForConditions.name)
|
|
446
|
+
// }
|
|
447
|
+
// },
|
|
448
|
+
// {
|
|
449
|
+
// 'acceptedOffers.itemOffered.reservationFor.name.en': {
|
|
450
|
+
// $exists: true,
|
|
451
|
+
// $regex: new RegExp(reservationForConditions.name)
|
|
452
|
+
// }
|
|
453
|
+
// }
|
|
454
|
+
// ]
|
|
455
|
+
// });
|
|
456
|
+
// }
|
|
456
457
|
/* istanbul ignore else */
|
|
457
458
|
if (reservationForConditions.location !== undefined) {
|
|
458
459
|
if (Array.isArray(reservationForConditions.location.branchCodes)) {
|
|
@@ -608,18 +609,18 @@ class OrderRepo {
|
|
|
608
609
|
}
|
|
609
610
|
});
|
|
610
611
|
}
|
|
611
|
-
/* istanbul ignore else */
|
|
612
|
-
if (params.orderDateFrom instanceof Date) {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
}
|
|
617
|
-
/* istanbul ignore else */
|
|
618
|
-
if (params.orderDateThrough instanceof Date) {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
}
|
|
612
|
+
// /* istanbul ignore else */
|
|
613
|
+
// if (params.orderDateFrom instanceof Date) {
|
|
614
|
+
// andConditions.push({
|
|
615
|
+
// orderDate: { $gte: params.orderDateFrom }
|
|
616
|
+
// });
|
|
617
|
+
// }
|
|
618
|
+
// /* istanbul ignore else */
|
|
619
|
+
// if (params.orderDateThrough instanceof Date) {
|
|
620
|
+
// andConditions.push({
|
|
621
|
+
// orderDate: { $lte: params.orderDateThrough }
|
|
622
|
+
// });
|
|
623
|
+
// }
|
|
623
624
|
if (params.orderDate !== undefined && params.orderDate !== null) {
|
|
624
625
|
if (params.orderDate.$gte instanceof Date) {
|
|
625
626
|
andConditions.push({
|
|
@@ -632,24 +633,24 @@ class OrderRepo {
|
|
|
632
633
|
});
|
|
633
634
|
}
|
|
634
635
|
}
|
|
635
|
-
if (params.price !== undefined && params.price !== null) {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
}
|
|
636
|
+
// if (params.price !== undefined && params.price !== null) {
|
|
637
|
+
// if (typeof params.price.$gte === 'number') {
|
|
638
|
+
// andConditions.push({
|
|
639
|
+
// price: {
|
|
640
|
+
// $exists: true,
|
|
641
|
+
// $gte: params.price.$gte
|
|
642
|
+
// }
|
|
643
|
+
// });
|
|
644
|
+
// }
|
|
645
|
+
// if (typeof params.price.$lte === 'number') {
|
|
646
|
+
// andConditions.push({
|
|
647
|
+
// price: {
|
|
648
|
+
// $exists: true,
|
|
649
|
+
// $lte: params.price.$lte
|
|
650
|
+
// }
|
|
651
|
+
// });
|
|
652
|
+
// }
|
|
653
|
+
// }
|
|
653
654
|
return andConditions;
|
|
654
655
|
}
|
|
655
656
|
/**
|
|
@@ -40,9 +40,6 @@ export declare class ProjectRepo {
|
|
|
40
40
|
id: string;
|
|
41
41
|
makesOffer: factory.project.IMakesOffer[];
|
|
42
42
|
}): Promise<void>;
|
|
43
|
-
activateOptionalAggregationSettings(params: {
|
|
44
|
-
id: string;
|
|
45
|
-
}): Promise<void>;
|
|
46
43
|
updateAggregateReservation(params: {
|
|
47
44
|
id: string;
|
|
48
45
|
aggregateReservation?: any;
|
|
@@ -157,16 +157,6 @@ class ProjectRepo {
|
|
|
157
157
|
}, { projection: { _id: 1 } })
|
|
158
158
|
.exec();
|
|
159
159
|
}
|
|
160
|
-
async activateOptionalAggregationSettings(params) {
|
|
161
|
-
await this.projectModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
|
|
162
|
-
$set: {
|
|
163
|
-
'settings.useAggregateEntranceGate': true,
|
|
164
|
-
'settings.useAggregateOffer': true,
|
|
165
|
-
'settings.useOfferRateLimit': true
|
|
166
|
-
}
|
|
167
|
-
}, { projection: { _id: 1 } })
|
|
168
|
-
.exec();
|
|
169
|
-
}
|
|
170
160
|
async updateAggregateReservation(params) {
|
|
171
161
|
await this.projectModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
|
|
172
162
|
$set: {
|
|
@@ -8,9 +8,7 @@ export interface IUpdatePartiallyParams {
|
|
|
8
8
|
export type ICancelResult = UpdateWriteOpResult;
|
|
9
9
|
export type ICheckedInResult = UpdateWriteOpResult;
|
|
10
10
|
type ISavingReservedTicket = Omit<factory.assetTransaction.reserve.ISubReservationReservedTicket, 'ticketType'> & {
|
|
11
|
-
ticketType
|
|
12
|
-
id?: string;
|
|
13
|
-
};
|
|
11
|
+
ticketType?: never;
|
|
14
12
|
};
|
|
15
13
|
/**
|
|
16
14
|
* ドキュメントとして保管する予約
|
|
@@ -63,7 +61,6 @@ export declare class ReservationRepo {
|
|
|
63
61
|
};
|
|
64
62
|
provider: factory.reservation.IProvider;
|
|
65
63
|
subReservation: factory.assetTransaction.reserve.IObjectSubReservation[];
|
|
66
|
-
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
67
64
|
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
68
65
|
reservationNumber: string;
|
|
69
66
|
underName?: factory.reservation.IUnderName;
|
|
@@ -147,6 +144,7 @@ export declare class ReservationRepo {
|
|
|
147
144
|
_id: string;
|
|
148
145
|
bookingAgent?: any;
|
|
149
146
|
previousReservationStatus?: factory.reservationStatusType;
|
|
147
|
+
priceCurrency?: factory.priceCurrency;
|
|
150
148
|
} & Required<{
|
|
151
149
|
_id: string;
|
|
152
150
|
}> & {
|
|
@@ -155,6 +153,7 @@ export declare class ReservationRepo {
|
|
|
155
153
|
_id: string;
|
|
156
154
|
bookingAgent?: any;
|
|
157
155
|
previousReservationStatus?: factory.reservationStatusType;
|
|
156
|
+
priceCurrency?: factory.priceCurrency;
|
|
158
157
|
} & Required<{
|
|
159
158
|
_id: string;
|
|
160
159
|
}> & {
|
|
@@ -114,15 +114,18 @@ class ReservationRepo {
|
|
|
114
114
|
const bulkWriteOps = [];
|
|
115
115
|
if (Array.isArray(params.subReservation)) {
|
|
116
116
|
params.subReservation.forEach((subReservation) => {
|
|
117
|
-
const { price: _discontinuePrice, reservedTicket,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
117
|
+
const { price: _discontinuePrice, reservedTicket, priceCurrency: _discontinuePriceCurrency, // discontinue priceCurrency
|
|
118
|
+
...subReservationWithoutPrice } = subReservation;
|
|
119
|
+
const { ticketType: _ticketType, ...reservedTicketWithoutTicketType } = reservedTicket;
|
|
120
|
+
// discontinue ticketType(2026-05-09~)
|
|
121
|
+
const savingReservedTicket = reservedTicketWithoutTicketType;
|
|
122
|
+
// // 予約ドキュメントのticketTypeを最小化(2026-04-03~)
|
|
123
|
+
// const savingReservedTicket: ISavingReservedTicket = {
|
|
124
|
+
// ...reservedTicketWithoutTicketType,
|
|
125
|
+
// ticketType: {
|
|
126
|
+
// ...((typeof ticketType.id === 'string') && { id: ticketType.id })
|
|
127
|
+
// }
|
|
128
|
+
// };
|
|
126
129
|
// reservationFor最小化(2026-04-06~)
|
|
127
130
|
const { minimizedReservationFor } = (0, minimizeReservationFor_1.minimizeReservationFor)(params.reservationFor);
|
|
128
131
|
const setOnInsert = {
|
|
@@ -132,7 +135,7 @@ class ReservationRepo {
|
|
|
132
135
|
bookingTime: params.bookingTime,
|
|
133
136
|
checkedIn: false,
|
|
134
137
|
attended: false,
|
|
135
|
-
issuedThrough: params.issuedThrough,
|
|
138
|
+
// issuedThrough: params.issuedThrough, // discontinue issuedThrough
|
|
136
139
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
137
140
|
reservationFor: minimizedReservationFor,
|
|
138
141
|
reservationNumber: params.reservationNumber,
|
|
@@ -125,48 +125,39 @@ function aggregateOfferByEvent(params) {
|
|
|
125
125
|
function aggregateReservationByOffer(params) {
|
|
126
126
|
return async (repos) => {
|
|
127
127
|
let reservationCount4offer;
|
|
128
|
-
// let attendeeCount4offer: number | undefined;
|
|
129
|
-
// let checkInCount4offer: number | undefined;
|
|
130
128
|
const reservationType = factory_1.factory.reservationType.EventReservation;
|
|
131
129
|
const offerIdsWithSameCategory = params.availableOffers.filter(({ category }) => {
|
|
132
130
|
return typeof category?.codeValue === 'string' && category.codeValue === params.offer.category?.codeValue;
|
|
133
131
|
})
|
|
134
132
|
.map(({ id }) => id);
|
|
135
133
|
if (offerIdsWithSameCategory.length > 0) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
reservationFor: { id: { $eq: params.event.id } },
|
|
139
|
-
reservationStatuses: [factory_1.factory.reservationStatusType.ReservationConfirmed],
|
|
140
|
-
// オファーカテゴリーごとに集計する(2024-11-10~)
|
|
141
|
-
// reservedTicket: { ticketType: { ids: [<string>params.offer.id] } }
|
|
142
|
-
reservedTicket: { ticketType: { ids: offerIdsWithSameCategory } }
|
|
143
|
-
});
|
|
144
|
-
// attendeeCount4offer = await repos.reservation.count({
|
|
134
|
+
// オファーIDによる集計を座席区分(オファーの適用座席区分を参照)による集計に変更(2026-05-05~)
|
|
135
|
+
// reservationCount4offer = await repos.reservation.count({
|
|
145
136
|
// typeOf: reservationType,
|
|
146
137
|
// reservationFor: { id: { $eq: params.event.id } },
|
|
147
138
|
// reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
148
|
-
//
|
|
149
|
-
// // reservedTicket: { ticketType: { ids: [<string>params.offer.id] } },
|
|
150
|
-
// reservedTicket: { ticketType: { ids: offerIdsWithSameCategory } },
|
|
151
|
-
// attended: true
|
|
152
|
-
// });
|
|
153
|
-
// checkInCount4offer = await repos.reservation.count({
|
|
154
|
-
// typeOf: reservationType,
|
|
155
|
-
// reservationFor: { id: { $eq: params.event.id } },
|
|
156
|
-
// reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
157
|
-
// // オファーカテゴリーごとに集計する(2024-11-10~)
|
|
158
|
-
// // reservedTicket: { ticketType: { ids: [<string>params.offer.id] } },
|
|
159
|
-
// reservedTicket: { ticketType: { ids: offerIdsWithSameCategory } },
|
|
160
|
-
// checkedIn: true
|
|
139
|
+
// reservedTicket: { ticketType: { ids: offerIdsWithSameCategory } }
|
|
161
140
|
// });
|
|
141
|
+
const aggregateSeatingType = params.offer.eligibleSeatingType?.at(0)?.codeValue;
|
|
142
|
+
if (typeof aggregateSeatingType === 'string') {
|
|
143
|
+
reservationCount4offer = await repos.reservation.count({
|
|
144
|
+
typeOf: reservationType,
|
|
145
|
+
reservationFor: { id: { $eq: params.event.id } },
|
|
146
|
+
reservationStatuses: [factory_1.factory.reservationStatusType.ReservationConfirmed],
|
|
147
|
+
reservedTicket: {
|
|
148
|
+
ticketedSeat: {
|
|
149
|
+
seatingType: { $in: [aggregateSeatingType] }
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
console.log('aggregateReservationByOffer: reservationCount4offer:', reservationCount4offer, 'aggregateSeatingType:', aggregateSeatingType, 'offer.id:', params.offer.id, 'offer.category:', params.offer.category?.codeValue);
|
|
154
|
+
}
|
|
162
155
|
}
|
|
163
156
|
const { maximumAttendeeCapacity, remainingAttendeeCapacity } = await calculateCapacityByOffer(params)(repos);
|
|
164
157
|
return {
|
|
165
158
|
aggregateReservation: {
|
|
166
159
|
typeOf: 'AggregateReservation',
|
|
167
160
|
reservationCount: reservationCount4offer
|
|
168
|
-
// attendeeCount: attendeeCount4offer, // discontinue(2024-11-10~)
|
|
169
|
-
// checkInCount: checkInCount4offer // discontinue(2024-11-10~)
|
|
170
161
|
},
|
|
171
162
|
...(typeof maximumAttendeeCapacity === 'number') ? { maximumAttendeeCapacity } : undefined,
|
|
172
163
|
...(typeof remainingAttendeeCapacity === 'number') ? { remainingAttendeeCapacity } : undefined
|
|
@@ -69,10 +69,11 @@ function createPotentialActions(params) {
|
|
|
69
69
|
const reservationForByReserveTransaction = transaction.object.transaction?.object.reservationFor;
|
|
70
70
|
if (reservationForByReserveTransaction !== undefined && typeof reservationNumber === 'string') {
|
|
71
71
|
const cancelObject = {
|
|
72
|
-
reservationFor
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
// discontinue reservationFor(2026-05-09~)
|
|
73
|
+
// reservationFor: {
|
|
74
|
+
// typeOf: reservationForByReserveTransaction.typeOf,
|
|
75
|
+
// id: String(reservationForByReserveTransaction.id)
|
|
76
|
+
// },
|
|
76
77
|
reservationNumber,
|
|
77
78
|
// ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
|
|
78
79
|
reservationStatus: factory_1.factory.reservationStatusType.ReservationConfirmed,
|
|
@@ -100,13 +101,15 @@ function createPotentialActions(params) {
|
|
|
100
101
|
cancelObject = {
|
|
101
102
|
typeOf: reservation.typeOf,
|
|
102
103
|
id: reservation.id,
|
|
103
|
-
issuedThrough
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
// discontinue issuedThrough(2026-05-08~)
|
|
105
|
+
// issuedThrough: {
|
|
106
|
+
// typeOf: reservation.issuedThrough?.typeOf
|
|
107
|
+
// },
|
|
108
|
+
// discontinue reservationFor(2026-05-09~)
|
|
109
|
+
// reservationFor: {
|
|
110
|
+
// typeOf: reservation.reservationFor.typeOf,
|
|
111
|
+
// id: String(reservation.reservationFor.id)
|
|
112
|
+
// },
|
|
110
113
|
reservationNumber: reservation.reservationNumber,
|
|
111
114
|
// ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
|
|
112
115
|
reservationStatus: factory_1.factory.reservationStatusType.ReservationConfirmed
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { AccountingReportRepo } from '../../repo/accountingReport';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
|
-
export declare function createAccountingReportIfNotExist(params: Pick<factory.order.IOrder, 'id' | 'orderNumber' | 'project' | '
|
|
4
|
-
acceptedOffers: factory.order.IAcceptedOffer[];
|
|
5
|
-
}): (repos: {
|
|
3
|
+
export declare function createAccountingReportIfNotExist(params: Pick<factory.order.IOrder, 'id' | 'orderNumber' | 'project' | 'paymentMethods' | 'seller' | 'typeOf' | 'orderDate'> & {}): (repos: {
|
|
6
4
|
accountingReport: AccountingReportRepo;
|
|
7
5
|
}) => Promise<void>;
|