@chevre/domain 24.0.0-alpha.45 → 24.0.0-alpha.47
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/lib/chevre/repo/assetTransaction/reserve.d.ts +30 -0
- package/lib/chevre/repo/assetTransaction/reserve.js +126 -0
- package/lib/chevre/repo/factory/reservation/createMongoConditions.d.ts +3 -0
- package/lib/chevre/repo/factory/reservation/createMongoConditions.js +771 -0
- package/lib/chevre/repo/reservation.d.ts +20 -9
- package/lib/chevre/repo/reservation.js +8 -752
- package/lib/chevre/repository.d.ts +7 -0
- package/lib/chevre/repository.js +16 -2
- package/lib/chevre/service/assetTransaction/cancelReservation/start.js +1 -1
- package/lib/chevre/service/reserve/cancelReservation.js +5 -4
- package/lib/chevre/service/reserve/confirmReservation.js +20 -3
- package/lib/chevre/service/reserve/findByCode.js +1 -1
- package/lib/chevre/service/reserve/findReservations.d.ts +19 -0
- package/lib/chevre/service/reserve/findReservations.js +74 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +5 -3
- package/lib/chevre/service/reserve/searchByOrder.js +3 -2
- package/lib/chevre/service/reserve/useReservation.js +1 -1
- package/lib/chevre/service/reserve.d.ts +2 -1
- package/lib/chevre/service/reserve.js +3 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.js +3 -2
- package/package.json +2 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
2
|
+
import * as factory from '../../factory';
|
|
3
|
+
type ISubReservationAsFindResult = Pick<factory.reservation.eventReservation.IReservation, 'underName' | 'id'> & {
|
|
4
|
+
price?: factory.reservation.eventReservation.IPrice;
|
|
5
|
+
reservedTicket?: Pick<factory.reservation.eventReservation.IReservedTicket, 'ticketType'>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* 予約取引リポジトリ
|
|
9
|
+
*/
|
|
10
|
+
export declare class ReserveTransactionRepo {
|
|
11
|
+
private readonly transactionModel;
|
|
12
|
+
constructor(connection: Connection);
|
|
13
|
+
/**
|
|
14
|
+
* 予約取引から予約を検索する
|
|
15
|
+
*/
|
|
16
|
+
findSubReservationsByReservationNumber(params: {
|
|
17
|
+
reservationNumber: string;
|
|
18
|
+
}): Promise<ISubReservationAsFindResult[]>;
|
|
19
|
+
/**
|
|
20
|
+
* 予約取引から予約を検索する
|
|
21
|
+
* limitはしない
|
|
22
|
+
*/
|
|
23
|
+
findSubReservationsById(params: {
|
|
24
|
+
/**
|
|
25
|
+
* 予約IDリスト
|
|
26
|
+
*/
|
|
27
|
+
ids: string[];
|
|
28
|
+
}): Promise<ISubReservationAsFindResult[]>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ReserveTransactionRepo = void 0;
|
|
27
|
+
const assetTransaction_1 = require("../mongoose/schemas/assetTransaction");
|
|
28
|
+
const factory = __importStar(require("../../factory"));
|
|
29
|
+
const settings_1 = require("../../settings");
|
|
30
|
+
/**
|
|
31
|
+
* 予約取引リポジトリ
|
|
32
|
+
*/
|
|
33
|
+
class ReserveTransactionRepo {
|
|
34
|
+
transactionModel;
|
|
35
|
+
constructor(connection) {
|
|
36
|
+
this.transactionModel = connection.model(assetTransaction_1.modelName, (0, assetTransaction_1.createSchema)());
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 予約取引から予約を検索する
|
|
40
|
+
*/
|
|
41
|
+
async findSubReservationsByReservationNumber(params) {
|
|
42
|
+
const aggregate = this.transactionModel.aggregate([
|
|
43
|
+
{
|
|
44
|
+
$match: {
|
|
45
|
+
typeOf: { $eq: factory.assetTransactionType.Reserve },
|
|
46
|
+
transactionNumber: { $eq: params.reservationNumber }
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
$unwind: {
|
|
51
|
+
path: '$object.subReservation'
|
|
52
|
+
// includeArrayIndex: 'elementIndex'
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
// {
|
|
56
|
+
// $match: {
|
|
57
|
+
// typeOf: { $eq: factory.assetTransactionType.Reserve },
|
|
58
|
+
// transactionNumber: { $eq: params.reservationNumber }
|
|
59
|
+
// }
|
|
60
|
+
// },
|
|
61
|
+
{
|
|
62
|
+
$project: {
|
|
63
|
+
_id: 0,
|
|
64
|
+
id: '$object.subReservation.id',
|
|
65
|
+
price: '$object.subReservation.price',
|
|
66
|
+
underName: '$object.underName',
|
|
67
|
+
reservedTicket: {
|
|
68
|
+
ticketType: '$object.subReservation.reservedTicket.ticketType',
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]);
|
|
73
|
+
// if (typeof filter.limit === 'number' && filter.limit > 0) {
|
|
74
|
+
// const page: number = (typeof filter.page === 'number' && filter.page > 0) ? filter.page : 1;
|
|
75
|
+
// aggregate.limit(filter.limit * page)
|
|
76
|
+
// .skip(filter.limit * (page - 1));
|
|
77
|
+
// }
|
|
78
|
+
return aggregate
|
|
79
|
+
.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
80
|
+
.exec();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 予約取引から予約を検索する
|
|
84
|
+
* limitはしない
|
|
85
|
+
*/
|
|
86
|
+
async findSubReservationsById(params) {
|
|
87
|
+
const { ids } = params;
|
|
88
|
+
if (!Array.isArray(ids) || ids.length === 0) {
|
|
89
|
+
throw new factory.errors.ArgumentNull('ids');
|
|
90
|
+
}
|
|
91
|
+
const aggregate = this.transactionModel.aggregate([
|
|
92
|
+
{
|
|
93
|
+
$match: {
|
|
94
|
+
typeOf: { $eq: factory.assetTransactionType.Reserve },
|
|
95
|
+
'object.subReservation.id': { $exists: true, $in: ids }
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
$unwind: {
|
|
100
|
+
path: '$object.subReservation'
|
|
101
|
+
// includeArrayIndex: 'elementIndex'
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
$match: {
|
|
106
|
+
'object.subReservation.id': { $exists: true, $in: ids }
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
$project: {
|
|
111
|
+
_id: 0,
|
|
112
|
+
id: '$object.subReservation.id',
|
|
113
|
+
price: '$object.subReservation.price',
|
|
114
|
+
underName: '$object.underName',
|
|
115
|
+
reservedTicket: {
|
|
116
|
+
ticketType: '$object.subReservation.reservedTicket.ticketType',
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
]);
|
|
121
|
+
return aggregate
|
|
122
|
+
.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
123
|
+
.exec();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.ReserveTransactionRepo = ReserveTransactionRepo;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { FilterQuery } from 'mongoose';
|
|
2
|
+
import * as factory from '../../../factory';
|
|
3
|
+
export declare function CREATE_MONGO_CONDITIONS(params: factory.reservation.ISearchConditions<factory.reservationType>): FilterQuery<import("@chevre/factory/lib/reservation/event").IReservation | import("@chevre/factory/lib/reservation/reservationPackage").IReservation>[];
|